Changing from char variable to another input

1 次查看(过去 30 天)
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 个评论
dpb
dpb 2019-10-8
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
Image Analyst 2019-10-8
What is a .mot file? Is it the same as a .mat file? Did you create it with the save() function?

请先登录,再进行评论。

采纳的回答

Joe Vinciguerra
Joe Vinciguerra 2019-10-8
编辑:Joe Vinciguerra 2019-10-8
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 个评论
Jake Bowd
Jake Bowd 2019-10-8
Brilliant, thank you so much for the help getting the .mot files in!
Are you able to direct me to how to create/write dedicated parsers for the other files?
(can you tell that I am new to Matlab?! :) )
Thank you so much
Jake Bowd
Jake Bowd 2019-10-9
Guillaume, how to I notify that I am happy with your answer and mark it as 'answered'?
P.s. if you are able to direct me to how to create/write dedicated parsers for the other files that would be really useful.
Cheers

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by