Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nitesh Kumar Singh
am 21 Sep. 2021
Kommentiert: Nitesh Kumar Singh
am 21 Sep. 2021
% INPUT OF INITIAL MATERIAL DISTRIBUTION
% ONLY in 1st ITERATION
if (a==1)
fid = fopen('emat_initial.txt','r');
temp = fscanf(fid,'%g',[1 inf]);
emat(:,1) = temp';
fclose(fid);
end
Error showing in this line emat(:,1) = temp';
0 Kommentare
Akzeptierte Antwort
KSSV
am 21 Sep. 2021
emat = cell([],1) ;
% INPUT OF INITIAL MATERIAL DISTRIBUTION
% ONLY in 1st ITERATION
if (a==1)
fid = fopen('emat_initial.txt','r');
temp = fscanf(fid,'%g',[1 inf]);
emat{1} = temp';
fclose(fid);
end
The problem is because of size temp. Know the isze of temp and initialize emat. If size is not know save them into a cell array as shown in the code.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!