How would I keep adding matrices to an array using a for loop?
Ältere Kommentare anzeigen
I have managed to concatenate two matrices, but I would like to have ten total - what is wrong with my code?
A=zeros(60,96);
for exp = 1:10;
n=1;
while n<61
pop=randperm(96,60);
m = pop(n);
A(n,m)=1;
start=A;
array=cat(3,start,A);
n=n+1;
end
end
1 Kommentar
Sean de Wolski
am 3 Aug. 2015
Perhaps this will help clarify for us: What is your end goal, i.e. what do you want the end array to look like (forget the steps for getting there right now)?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!