필터 지우기
필터 지우기

call every row of matrix in each iteration

조회 수: 1 (최근 30일)
fatema saba
fatema saba 2015년 11월 7일
편집: per isakson 2015년 11월 7일
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개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by