Unable to perform assignment because the size of the left side is 1-by-3-by-12-by-3 and the size of the right side is 3-by-12-by-2

1 view (last 30 days)
Ashley Miller
Ashley Miller on 1 Apr 2021
Answered: KSSV on 24 Dec 2021
flist=dir('*nirs');
startTime=(2*25)+1;
endTime=startTime+(6*25);
for f=1:numel(flist)
load(flist(f).name,'-mat')
HbAvg(f,:,:,:)=squeeze(mean(procResult.dcAvg(startTime:endTime,:,:,:)));
end
  2 Comments

Sign in to comment.

Answers (1)

KSSV
KSSV on 24 Dec 2021
When you are not sure of the dimension of the RHS matrix to save into LHS, you better save into a cell.
flist=dir('*nirs');
startTime=(2*25)+1;
endTime=startTime+(6*25);
N = numel(flist) ;
HbAvg = cell(N,1) ;
for f=1:numel(flist)
load(flist(f).name,'-mat')
HbAvg{f}=squeeze(mean(procResult.dcAvg(startTime:endTime,:,:,:)));
end

Tags

Community Treasure Hunt

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

Start Hunting!