MATLAB: Structure Export

exportMATLABstructures

I am trying to do something which I feel is pretty simple. I'm trying to export each of 4 fields from a structure to a .txt file. I'd like the text file to be comma delimited. 3 of my fields are character and 1 is double. Is this a fairly simple thing to do?
Thanks, Brian

Best Answer

Structure, or structure array?
Structure case:
t = struct2cell(S);
fprintf(fid, '%s,%s,%s,%f\n', t{:});