Can I split an array by a specific word?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello everyone - I have a large messy excel worksheet which includes a lot of text. I have read in a specific column using xlsread and I need to count the number of times a certain word appears within that column. The problem is there are multiple output files from another program saved to this same excel sheet. I need to count these words for each file. The columns I need to analyze are always the same, but the number of rows is always different. For example column E which is now a cell array in matlab includes output from three different files and I need to separate the array somehow into three different arrays. The only thing that is consistent in these excel sheets is when a new file is being coded in the other program a code appears in the excel column which reads VTNxxx. Therefore, is there someway to split this array by that specific word?
thank you - any suggestions would be appreciated.
0 comentarios
Respuestas (1)
per isakson
el 1 de Mzo. de 2015
Editada: per isakson
el 2 de Mzo. de 2015
Try
>> cac = strsplit('Can I split an array by a specific word?', 'array')
cac =
'Can I split an ' ' by a specific word?'
Then try this
str = 'Can I split an array by a specific word?';
cac = strsplit( str, 'array' );
cell_array = strsplit( str, ' ' );
ix = find( strcmp( 'array', cell_array ) );
head = cell_array( 1 : ix-1 );
tail = cell_array( ix+1 : end );
0 comentarios
Ver también
Categorías
Más información sobre Cell Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!