Changing from char variable to another input
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Jake Bowd
el 8 de Oct. de 2019
Comentada: Jake Bowd
el 9 de Oct. de 2019
Forgive my naivity on this one. How can I change a 1x47004 char to a matrix which has letters/words in some cells and numbers in the rest? At present I have the following 6x6 cell.
1x47004 char [] [] [] [] []
1x45843 char [] [] [] [] []
1x46992 char [] [] [] [] []
1x46432 char [] [] [] [] []
1x46459 char [] [] [] [] []
1x48191 char [] [] [] [] []
5 comentarios
dpb
el 8 de Oct. de 2019
OK, you're trying to read some custom format it appears.
Attach a section of one of the underlying .mot files so we can see what you're actually starting from.
The conversion from the .mat file is trying to fixup after a mess; better by far to avoid the mess in the first place instead.
Image Analyst
el 8 de Oct. de 2019
What is a .mot file? Is it the same as a .mat file? Did you create it with the save() function?
Respuesta aceptada
Joe Vinciguerra
el 8 de Oct. de 2019
Editada: Joe Vinciguerra
el 8 de Oct. de 2019
Your *.mot files are coming in as one very long character array.
You can either try to parse it character-by-character into a cell array, or table, or structure, etc... OR import your data differently.
Try using the readtable function
Try this:
for i = 1 : nfiles
data{i} = readtable(fullfile(testfiledir, matfiles(i).name));
end
10 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings 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!