フィルターのクリア

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 Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by