How to save data at each iteration in a cell array?

조회 수: 3(최근 30일)
Joana
Joana 2020년 4월 17일
댓글: Rik 2020년 4월 17일
Hi,
I have saved data sests where i have two variables of 3-D, A and B. I want to load it for each subject and save it in a cell array, as the variables have the same name for each subject. But the size is varied across each subject.
How can i do that.?
I am doing following:
for subject= 1:2
resultFileName = sprintf('Sub0%i_Epochs.mat',subject); % generate result filename
load(resultFileName)
A_Epochs{:,:,:}= epochs([1: size(epochs,1)/2],6,:);
B_Epochs{:,:,:}= epochs([size(epochs,1)/2+1:end],6,:);
end
  댓글 수: 3
Rik
Rik 2020년 4월 17일
This question was continued here.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 4월 17일
A_Epochs{subject}= epochs([1: size(epochs,1)/2],6,:);
B_Epochs{subject}= epochs([size(epochs,1)/2+1:end],6,:);
  댓글 수: 3
Joana
Joana 2020년 4월 17일
Thanks for you reply Walter.
I got it.
i need to take 'Mean' of cell array of A_Epochs and B_Epochs separately. I am new to MATLAb so i don't know how to do that.?
Can you help please.?

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by