How can I select numbers from excel to matlab?
3 views (last 30 days)
Show older comments
Hi, I have an excel file with only 1 column and every cell results as follows:
'2019-10-12T02:41:27.091Z,1/0669958925:52238,-5.9858581261e-02,-1.7725070822e-04,+1.1940838453e-03'
In order to pass from excel to matlab i wrote the following:
[num,str]=xlsread('file1');
num is empty, str is a Nx1 cell. Each cell is a char like the following I wrote before.
How can I extrapolate the last 3 numbers and the date at the beginning of this char? Thank you for the help!
2 Comments
Answers (1)
David Hill
on 20 Apr 2021
str=readcell('test.xlsx');
%str={'2019-10-12T02:41:27.091Z,1/0669958925:52238,-5.9858581261e-02,-1.7725070822e-04,+1.1940838453e-03'}
for k=1:length(str)
T(1,:)=[regexp(str{k},'\d{4}[-]\d{2}[-]\d{2}','match'),regexp(str{k},'[+-]\d+[.]\d+[e][-]\d+','match')];
end
0 Comments
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!