Hello, I have a uitable with double values:
data = 374.35 406.81 383.00 336.46 297.88 436.10 362.88 303.35 245.88 199.66 189.35 200.21 218.86 223.13 204.46 341.85 322.08 288.71 239.71 203.11
I am wanting to display these in the uitable with only 1 decimal place (they are currently displayed as 4 decimal places)
I found the following on this site:
%Convert to user precision
data = get(t, 'data') class(data) for i = 1:numel(data) % if(isnumeric(data{i}))
tempStr = sprintf('%2.4g', data{i}); data{i} = tempStr; % end
end set(t, 'data', data);
However I get the error "Cell contents referenced from a non-cell array object" in this line tempStr = sprintf('%2.4g', data{i});
Best Answer