call every row of matrix in each iteration
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have matrix a with 1 row and 300 columns. this matrix is composed of randomly elements between 1 to 300:
a=randi(300,[1 300])
I reshaped it the matrix with 6 rows and 50 columns. I want to call in every time one of rows and use it like that:
for it=1:30
show=it
c=reshape(a,6,[])';
[l1 l2]=size(c);
rm=rem(it,l1);
if it<=l1;
k=c(it,:)
elseif it>l1
q=rm+1;
k=c(q,:)
end
for i=k
for j=k
d=sum(k)
end
end
end
I have two question please. why is (d) written four times in each iteration? can I chage it? can I vectorize this code? thank you.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!