Indexing a cell array column from multiple sources

2 ビュー (過去 30 日間)
Niels van Dalen
Niels van Dalen 2020 年 7 月 11 日
コメント済み: Niels van Dalen 2020 年 7 月 11 日
Hi, I need to index a column of a 'results' table using different different sources.
The first row is empty (' '), the rows after that are the names from a filelist ('FileList.name'), this works fine.
However, the rows after that I'd like to assign elements from my string 'combinedToneNames'.
But I can't get this to work nicely: getting all 3 tone names (see snippet below) to show up below each other in new rows.
combinedToneNames = ['ClowD(-0dB)', 'EF(-0dB)', 'BChigh(-0dB)'];
results = {'', FileList.name, combinedToneNames}';
This gives the following result, I've clarified it a bit as well as added what I'd want it to be like:
combinedToneNames appears to be a 1x31 char, so I then tried splitting the string on whitespaces ( )
combinedToneNames = ['ClowD(-0dB)' 'EF(-0dB)' 'BChigh(-0dB)'];
splitCombToneNames = split(combinedToneNames);
results = {'', FileList.name, splitCombToneNames}';
This gave the exact same result as above.
I also tried looping through combinedToneNames:
combinedToneNames = ['ClowD(-0dB)', 'EF(-0dB)', 'BChigh(-0dB)'];
for kk = 1:length(combinedToneNames)
results = {'', FileList.name, combinedToneNames(kk)}';
end
This gave:
Anyone knows how to get information from a char to index different rows?

採用された回答

madhan ravi
madhan ravi 2020 年 7 月 11 日
FileList.name = {'sjdjd.wav', 'sjdjf.wav'}; % example names
combinedToneNames = {'ClowD(-0dB)', 'EF(-0dB)', 'BChigh(-0dB)'};
results = [{[]}, FileList.name, combinedToneNames].'
  1 件のコメント
Niels van Dalen
Niels van Dalen 2020 年 7 月 11 日
This works, thanks a lot man <3 :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by