I have the following code to save the contents of a uitable but for a fixed number of columns. How can I make it generic so it will work with any number of columns?
inputdata=(get(handles.uitableDark,'Data'))%inputdata=cell2mat(inputdata)
[name,path] = uiputfile('C:\DarkFPN.txt','Save file name');file=fullfile(path,name)%save(file,'inputdata','-ascii');
fid = fopen(file,'wt'); if fid > 0 [nrows,ncols] = size(inputdata); for row = 1:nrows inputdata{row,:} fprintf(fid,'%.0f %.2f %.2f %.2f %.2f\n',inputdata{row,:}); end fclose(fid); endThanksJason
Best Answer