Can I split an array by a specific word?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
per isakson
il 1 Mar 2015
Modificato: per isakson
il 2 Mar 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 Commenti
Vedere anche
Categorie
Scopri di più su Cell Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!