Indexing a cell array column from multiple sources

1 view (last 30 days)
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?

Accepted Answer

madhan ravi
madhan ravi on 11 Jul 2020
FileList.name = {'sjdjd.wav', 'sjdjf.wav'}; % example names
combinedToneNames = {'ClowD(-0dB)', 'EF(-0dB)', 'BChigh(-0dB)'};
results = [{[]}, FileList.name, combinedToneNames].'

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!