MATLAB: Printing a cell matrix to a text file

cell arraysfprintf

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

Best Answer

fid=fopen('filename.txt','w')
for k=1:size(C,1)
fprintf(fid,'%s %d %d %s\r\n',C{k,:})
end
fclose(fid)