Saving to structured variable in loop

1 回表示 (過去 30 日間)
Jakub
Jakub 2013 年 3 月 14 日
Hi This is part of my code:
for i=1:18
for j=i+1:19
x = data(i,:);
y = data(j,:);
wcoh.(i,j)=wcoher(x,y);
end
end
Function wcoher computes from two rows of data one matrix. But i have 19 rows of data. And i want to compute wcoher for each pair. So the result would be structured variable for example wcoh->inside it variables 1-2,1-3,1-4,....5-6,...18-19-> and inside matrix computed by wcoher function.
Thx for help!!
  2 件のコメント
Andrei Bobrov
Andrei Bobrov 2013 年 3 月 14 日
What are return wcoher ? Scalar or array?
Jakub
Jakub 2013 年 3 月 14 日
matrix

サインインしてコメントする。

採用された回答

Alessandro
Alessandro 2013 年 3 月 14 日
編集済み: Alessandro 2013 年 3 月 15 日
If I understand you right you wannt to have:
wcoh= cell(Ny,Nx);
for i=1:Ny
for j=i+1:Nx
x = data(i,:); y = data(j,:);
wcoh{i,j}=wcoher(x,y);
end
end
  1 件のコメント
Jakub
Jakub 2013 年 3 月 15 日
Thanks, it works perfectly!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWavelet Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by