Info

This question is closed. Reopen it to edit or answer.

Limiting vectors to a certain number of rows

1 view (last 30 days)
Giovanni
Giovanni on 12 Dec 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi, i have created a function that creates n lots of a matrix of 3 columns but different number of rows. How do i limit the number of rows of this matrixes to say 4 for each one?

Answers (1)

Andrei Bobrov
Andrei Bobrov on 12 Dec 2013
n = 7;
out = arrayfun(@(x)rand(randi(4),3),1:n,'un',0);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!