printing a cell matrix to a text file
1 view (last 30 days)
Show older comments
Hi,
I have a 9 x 4 cell matrix, called C, the first and last columns have text, the other 2 columns have numbers, as shown below:
C =
'har( ' [0.5189] [252.3755] 'true'
'har( ' [0.1816] [289.4976] 'true'
'har( ' [0.1015] [231.4329] 'true'
'har( ' [0.0523] [269.8641] 'true'
'har( ' [0.0454] [128.8302] 'true'
'har( ' [0.0451] [121.8095] 'true'
'har( ' [0.0149] [140.7870] 'true'
'har( ' [0.0124] [271.3026] 'true'
'har( ' [0.0069] [ 88.0826] 'true'
I would like to send this to a text file for use elsewhere, please can you help.
Also, I would like to remove the quotation marks on the text and the square brackets for the numbers when if appears in the text file if possible.
Cheers
Danny
0 Comments
Accepted Answer
Azzi Abdelmalek
on 8 Nov 2013
Edited: Azzi Abdelmalek
on 8 Nov 2013
fid=fopen('filename.txt','w')
for k=1:size(C,1)
fprintf(fid,'%s %d %d %s\r\n',C{k,:})
end
fclose(fid)
0 Comments
More Answers (1)
See Also
Categories
Find more on Inputs 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!