Extract numbers out of a .mat file that has both characters and numbers
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Karthik
el 16 de Jul. de 2015
Hi, How can I extract numbers out of this .mat file ? Thanks.
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 17 de Jul. de 2015
Editada: Azzi Abdelmalek
el 17 de Jul. de 2015
a=regexp(text,'(?<==)\d+(.)?(\d+)?','match','once')
id=~cellfun(@isempty,a(:,1))
a=str2double(a(id))
2 comentarios
Stephen23
el 17 de Jul. de 2015
Editada: Stephen23
el 17 de Jul. de 2015
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Import and Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!