printing a cell matrix to a text file
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Danny Coles
il 8 Nov 2013
Risposto: Danny Coles
il 8 Nov 2013
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 Commenti
Risposta accettata
Azzi Abdelmalek
il 8 Nov 2013
Modificato: Azzi Abdelmalek
il 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 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Inputs in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!