Extract numbers out of a .mat file that has both characters and numbers
1 次查看(过去 30 天)
显示 更早的评论
Hi, How can I extract numbers out of this .mat file ? Thanks.
0 个评论
采纳的回答
Azzi Abdelmalek
2015-7-17
编辑:Azzi Abdelmalek
2015-7-17
a=regexp(text,'(?<==)\d+(.)?(\d+)?','match','once')
id=~cellfun(@isempty,a(:,1))
a=str2double(a(id))
2 个评论
Stephen23
2015-7-17
编辑:Stephen23
2015-7-17
Standard scientific notation using "E" syntax does not use any multiplier symbol, so your source data is non-standard and therefore MATLAB does not recognize it. Therefore you basically have two choices:
- Change the source data to use standard E-notation.
- Read the data into MATLAB as strings, and then do some hackery using regexprep before converting to numeric.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!