i have many stations and i want to choose the highest load cost as first and so on
i have six stations with different loads

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 23 Mär. 2016

0 Stimmen

[maxload, maxidx] = max(TheLoads)
now maxload stores the value of the largest of TheLoads, and maxidx stores the index within TheLoads, so it tells you which load is largest.

3 Kommentare

ABDULLA RAHIL
ABDULLA RAHIL am 23 Mär. 2016
thanks walter but in my case i have 6 stations and 365 days so i need to choose the largest every step , this means that sometimes in the first step the largest in station1 but inthe second in staion6 and so on , how can make it follow all steps and compare between stations and choose the largest ,
If TheLoads is a 6 x 365 array, then
[maxload, maxidx] = max(TheLoads);
will have maxload be the maximum per day and maxidx will be the index of the maximum for each day. If your array is 365 x 6 instead, then
[maxload, maxidx] = max(TheLoads, [], 2);
ABDULLA RAHIL
ABDULLA RAHIL am 24 Mär. 2016
many thanks for your help Walter

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by