how can i make matlab select a value for a vector variable from a set of data
1 回表示 (過去 30 日間)
古いコメントを表示
i am doing optimization design model that compare the fuel consumption of different diesel engines.
so, i have excel sheet contains the MCR of different diesel engines from manufactureres.
i have defined a variable MCR and i want matlab to assign a value for MCR from the values of MCR data that stored in excel sheet
i want that to be done automatically every time the optimization algorithm run a new attempt.
what is the function i should use to assign the value of MCR from the created set of data?
0 件のコメント
採用された回答
darova
2020 年 2 月 19 日
Use xlsread
MCRdata = xlsread('data.xls'); % read data from excel file
MCR0 = MCRdata(5); % assign 5th value
4 件のコメント
darova
2020 年 2 月 20 日
What about this trick?
MCRdata = [250; 450;1500;900;2500;2000;1750];
ix = randi(length(MCRdata),1,length(MCR));
MCR = sym( MCRdata(ix) );
[ix' MCR]
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Export to MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!