# how to create different matrices?

3 views (last 30 days)
arian hoseini on 7 Dec 2022
Commented: arian hoseini on 7 Dec 2022
i have 30,000 rand value that i want to separate 400 to 400...then i wanna plot them but the x axis should start at 0 not 400 or 800 or...any help please?
arian hoseini on 7 Dec 2022
for the matrix lets say i have 10 num in a matrix but i want to change it into 10 matrices...
[1 2 3 4 5 6 7 8 9 10]
[1]
[2]
.
.
[10]

Jonas on 7 Dec 2022
you could split them into multiple 400x1 vectors by this
data=rand(30000,1);
data=reshape(data,400,1,[]);
size(data)
ans = 1×3
400 1 75
you can then get each vector using indexing data(:,:,idx)
for idx=1%:75 % commented out to avoid to much plotting here
plot(0:399,data(:,:,idx));
% saveas(gcf,[num2str(idx),'.jpg']);
end
arian hoseini on 7 Dec 2022
thanks

### Categories

Find more on Graphics Object Programming in Help Center and File Exchange

R2016b

### Community Treasure Hunt

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

Start Hunting!