Borrar filtros
Borrar filtros

Indexing a cell array column from multiple sources

1 visualización (últimos 30 días)
Niels van Dalen
Niels van Dalen el 11 de Jul. de 2020
Comentada: Niels van Dalen el 11 de Jul. de 2020
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?

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by