Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.

1 view (last 30 days)
flag = 1;
n = 1;
while flag == 1
if feof(fid)
flag=-1;
else
tmp = fgets(fid);
while size(tmp,2) < columnwidth;tmp = [tmp,' '];end
subjectID(n,:)=tmp;n=n+1;
end
end
Recieving this error regarding subjectID(n,:)=tmp;n=n+1;
Ran this script/code previously in Matlab2019 so unsure if this might be why this issue is arising now? Any insight would be greatly appreciated!

Accepted Answer

VBBV
VBBV on 7 Apr 2021
%if true
subjectID{n,:}=tmp;n=n+1
  1 Comment
Vanessa Lopez
Vanessa Lopez on 7 Apr 2021
Thank you! That worked, however, I am next receiving this error:
Error using cd
Path must be a string scalar or character vector.
In regards to this line of code:
tmp_subjectID = deblank(subjectID(master,:));
currentdir = [subject_folder,'/',tmp_subjectID,'/mri/assembly'];
cd (currentdir);
I'm wondering if it has something to do with the defined tmp_subjectID from the prior error?

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!