Borrar filtros
Borrar filtros

Error using sortrows in my optimisation script after for loop

4 visualizaciones (últimos 30 días)
Rigo ZOO
Rigo ZOO el 31 de En. de 2024
Editada: Torsten el 31 de En. de 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 comentarios
Rigo ZOO
Rigo ZOO el 31 de En. de 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 el 31 de En. de 2024
Editada: Torsten el 31 de En. de 2024
Before calling "sortrows", insert the two lines of code
size(sol)
class(sol)
and tell us what MATLAB prints to console.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by