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 CenterFile Exchange에서 Wavelet Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by