MATLAB: Combining cell arrays and copying to clipboard

cell arraysclipboardconcatenate

I cannot get two cell arrays to catenate and then copy to clipboard.
%Get two cell arrays
s=get(handles.uitable1,'data');
cname=get(handles.uitable1, 'columnname')
*%there are 3 columns, first is text, other two are floats)*
ab = cat(1, cname', (s));
str=sprintf('%s = %s\t%f\t%f\n', ab{:})
clipboard ( 'copy', str );
This is the output of ab:
'title1' 'title2' 'title3'
'sample1' '0.9940' [ 0.2370]
'sample2' '0.9948' [ 0.2320]
'sample3' '0.9950' [ 0.2211]

Best Answer

This works:
ab = ab'; %transpose so the values arrive in the right order for the 2nd sprintf
str = sprintf('%s\t%s\t%s\n', ab{:, 1}); %print first row exclusively as text
str = [str sprintf('%s\t%s\t%f\n', ab{:, 2:end})]