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)
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
Ashley Miller
Ashley Miller on 1 Apr 2021
Error in HbAverager (line 12)
HbAvg(f,:,:,:)=squeeze(mean(procResult.dcAvg(startTime:endTime,:,:,:)));
This is the error that keeps popping up.

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

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!