Borrar filtros
Borrar filtros

call every row of matrix in each iteration

1 visualización (últimos 30 días)
fatema saba
fatema saba el 7 de Nov. de 2015
Editada: per isakson el 7 de Nov. de 2015
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.

Respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by