How can I write any cell data into txt file as they appear.
Show older comments
for example;
data= { 'a' 1 2 3 ; 'b' 4 5 6 }
startingFolder = 'C:\Program Files\MATLAB'
if ~exist(startingFolder, 'dir')
startingFolder = pwd
end
defaultFileName = fullfile(startingFolder, '*.txt')
[baseFileName, folder] = uiputfile(defaultFileName, 'Select a file')
if baseFileName == 0
return
end
fullFileName = fullfile(folder, baseFileName)
fid = fopen(fullFileName, 'wt')
fwrite(fid, data) %error using fwrite Cannot write value: unsupported class cell
fclose(fid)
I wanna write numbers as ASCII format with characters. like;
a 1 2 3
b 4 5 6
Accepted Answer
More Answers (1)
David Sanchez
on 29 May 2013
0 votes
you should follow the link above:
It provides a m-file to write cells to txt
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!