Export values from cell array

1 view (last 30 days)
Mafalda Couto
Mafalda Couto on 18 Sep 2017
Edited: Walter Roberson on 19 Sep 2017
I have a txt file that includes events reported during acquisition. This is cell array that has textual data mixed with numerical data. For example:
Events_data [4x1 cell]:
'Acquisition started'
'30mg of XYZ were inserted'
'no response'
'end of acquisiotion'
I mean to export the data from the amount of XYZ used and the row in the array it was recorded (because i mean to associate with other array that includes time of recording). The code I am currently using is:
for n=1:(length(Events_data))
if findstr(char(Events_data{1,4}(n,1)), 'XYZ')>0
Dose(n,1)=sscanf(char(Events_data{1,4}(n*3+1,1)),'%d'); %the error is reported here
This detects when "XYZ" is declared and searches for any value in that cell. This is working fine for some of the .txt data files however some other are reporting 'Subscripted assignment dimension mismatch.' but all have the same source.
Could the txt files be corrupted or am I doing some mistake?
Thank you

Answers (0)

Community Treasure Hunt

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

Start Hunting!