matlab - conversion of cell to matrix that contains text? -
I have a text file that has measurement data, the header is not important, so I used to remove 25 lines before it
% I = 1: 25 Leave the first 25 rows for fgetl (inputfile);
Then I used the delimiter to get the data
delimiter = ''; Values = textscan (inputfile, '% s', 'delimiter', delimiter);
I'm trying to change the cell with 1000 characters in the I Here's what I found
'2014_11_03_17-19-49 000 430114 516672 960.91 26.2 '' 20l4_ll_03_l7-l9-49 001 430 112 516 656 960.91 26.2 '' 20l4_ll_03_l7-l9-49 002 430 112 516 656 960.91 26.2 '' 20l4_ll_03_l7-l9-49 003 430 112 516 656 960.91 26.2 "I am trying to change the cell In which there are 1000 characters, as in the past I (960.91 and 26.2). I tried to convert it to matrix but I can not support
this error cell array or cell array containing the object.
How to get those values in the matrix to plot those ideas to conspiracy those ideas.
approach # 1 > -
lines_skip = 25; Values = Ayatdeta (input file, 'Lain_skip)' here
Using% // delimiter value
Inputfile
.
Thus, will be the fourth column
values.data (:, 4)
, while values.data (:, 5)
will be fifth
as shown here -
& gt; & Gt; Values.data (:, 4) ans = 960.9100 960.9100 960.9100 960.9100 & gt; & Gt; Values.data (:, 5) ans = 26.2000 26.2000 26.2000 26.2000
approach # 2
If you already have Same is the cell array listed in the question, you do not have to worry about reading the input file again. So, you have something like -
incell = { '2014_11_03_17-19-49 000 430114 516672 960.91 26.2' '2014_11_03_17-19-49 001 430112 516656 960.91 26.2' '2014_11_03_17-19- 49 002 430112 516656 960.91 26.2 '' 2014_11_03_17-19-49 003 430112 516656 960.91 26.2 '}
Next, you Selfn
and regexp
delimiters each chamber ''
-
cellarr = cellfun (@ (x) regexp (x, '', 'Split'
who will get you -
value = '2014_11_03_17-19-49' '000' '430114' '516672' '960.91 '26.2' '2014_11_03_17-19-49' '001' '430112' '516656' '960.91 '26.2' '2014_11_03_17-19-49' '002' '430112' '516656' '960.91 '26.2' '2014_11_03_17-19-49' '003' '430112 '' 516656 '' 960.91 ''26.2' '
That is, find and str < / Div>
Comments
Post a Comment