Error using sortrows in my optimisation script after for loop

3 vues (au cours des 30 derniers jours)
Rigo ZOO
Rigo ZOO le 31 Jan 2024
Modifié(e) : Torsten le 31 Jan 2024
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 commentaires
Rigo ZOO
Rigo ZOO le 31 Jan 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 le 31 Jan 2024
Modifié(e) : Torsten le 31 Jan 2024
Before calling "sortrows", insert the two lines of code
size(sol)
class(sol)
and tell us what MATLAB prints to console.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by