Can I split an array by a specific word?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
per isakson
am 1 Mär. 2015
Bearbeitet: per isakson
am 2 Mär. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!