Error using sortrows in my optimisation script after for loop

3 visualizzazioni (ultimi 30 giorni)
Error using matlab.internal.math.sortrowsParseInputs Column sorting vector must contain integers with absolute value between 1 and the number of columns in the first argument. Error in sortrows (line 64) [col, nanflag, compareflag] = matlab.internal.math.sortrowsParseInputs(ismatrix(A),size(A,2),A,varargin{:}); Error in TLP (line 110) sol_sorted = sortrows(sol,17);
  3 Commenti
Rigo ZOO
Rigo ZOO il 31 Gen 2024
Hi Torsten,
Thank you, but checked sol which has 8 column, but I still have the same error
% Dt = 4*((Fb/(4*rho_Water))-(Width - 2*Dc)*Hp)/(pi*Dc.^2);
if (GM>MetaC)%&& Dc < Cs && Dc>lpt && Dt>Hp && Hc>Dt
% data_feasible=[data_feasible; Dc, Hc, Hp, Mt, Dtd, DeckH, Dt];
W = MassT + Mt + 4*(Vc1+Vc2)*rhoCL + 4*Vn*rhoNd + 4*Vp*rhoPT + Nm*Vtd*rhoTD ;
% TMass = MassT + Mt + 4*(Vc1+Vc2)*rhoCL + 4*Vn*rhoNd + 4*Vp*rhoPT + Nm*Vtd*rhoTD ;
sol=[sol; Dt, DeckH, Dtd, Mt, Hp, Hc, Dc, W]; %#ok<AGROW> % Store the feasible solution
end
end
end
end
end
end
end
end
% sort the matrix of feasible solutions based on the objective (here vol, the third column)
sol_sorted = sortrows(sol,8);
% Select the first solution (which is the optimum after sorting all solutions based on the objective)
opt_sol=sol_sorted(1,:);
Torsten
Torsten il 31 Gen 2024
Modificato: Torsten il 31 Gen 2024
Before calling "sortrows", insert the two lines of code
size(sol)
class(sol)
and tell us what MATLAB prints to console.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by