How to save table (or cell) as file with custom extension?

30 views (last 30 days)
I have a table that I need to save as a file with a .in extension. The table contains multiple data types (numbers and strings).
writetable (and writecell) do not allow saving with a .in extension. The 'save' function does, but does not save the data properly (saves as unicode, and the program I ultimately need to load the .in file into will not recognize it).
Not a matlab expert by any means, so this may be obvious to some. Would appreciate any help.

Accepted Answer

Voss
Voss on 21 Jun 2022
"writetable (and writecell) do not allow saving with a .in extension."
Yes they do, but you must explicitly specify the FileType:
writecell({1 'ok' 3},'test.in','FileType','text')
type test.in % show the contents of test.in
1,ok,3

More Answers (0)

Categories

Find more on Data Type Identification in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!