Trouble accessing and printing the parameters from a Bus in a MATLAB Script
3 ビュー (過去 30 日間)
古いコメントを表示
Santiago Jose Flores Siguenza
2022 年 3 月 25 日
回答済み: Fangjun Jiang
2022 年 3 月 25 日
I am trying to write a list of all the names of a bus I'm using as argument for a MATLAB Function.
Right now I'm using:
function write_list(busObject)
fileID = fopen('list.m', 'w');
fprintf(fileID, busObject.Elements.Name);
fclose(fileID);
The Output is just the first element of the bus. There are a lot of elements. Can someone please enlighten me?
I was expecting the output I get when calling busObject.Elements.Name in a command Windows with all of the names. Right now I only get the first one.
0 件のコメント
採用された回答
Fangjun Jiang
2022 年 3 月 25 日
function write_list(busObject)
fileID = fopen('list.m', 'w');
ElementNames={busObject.Elements.Name};
fprintf(fileID, '%s\n',ElementNames{:});
fclose(fileID);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!