Subscripted assignment dimension mismatch.

1 Ansicht (letzte 30 Tage)
tahseen alshmary
tahseen alshmary am 16 Nov. 2018
Kommentiert: tahseen alshmary am 25 Nov. 2018
I have this error
((Subscripted assignment dimension mismatch))
appear with this function
for i=1:50
f0(i,1)=ofun(x0(i,:));
end
how can i solve this problem?

Akzeptierte Antwort

madhan ravi
madhan ravi am 16 Nov. 2018
Bearbeitet: madhan ravi am 16 Nov. 2018
f0=cell(1,50); %preallocation
for i=1:50
f0{i}=ofun(x0(i,:));
end
celldisp(f0)
  3 Kommentare
madhan ravi
madhan ravi am 16 Nov. 2018
Anytime :)
tahseen alshmary
tahseen alshmary am 25 Nov. 2018
Dear sir also appear same error with this equation in same code
((Subscripted assignment dimension mismatch))
do you have solution for this equation
ffmin(ite,run)=fmin;
the code is
% evaluating fitness
f=cell(1,50); %preallocation
for i=1:n
f{i}=ofun(x(i,:));
end
% updating pbest and fitness
for i=1:n
if f{i}<f0{i}
pbest(i,:)=x(i,:);
f0{i}=f{i};
end
end
[fmin,index]=min(f0{i});
% finding out the best particle
ffmin(ite,run)=fmin; % storing best fitness

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by