Display mean +/- std in a table or matrix

9 views (last 30 days)
Hi, is it possible to display in a matrix or table (e.g. uitable) numbers like: 5 setstr(177) 4.5 6 setstr(177) 6.4 where setstr(177) is +/- sign? That is mean +/- of std.

Accepted Answer

Image Analyst
Image Analyst on 5 Nov 2012
Edited: Image Analyst on 5 Nov 2012
You can construct a uitable, either easily in GUIDE, or do it yourself via code with uitable(). Then load up a cell array with whatever (numbers, strings, etc.) and set the data property equal to it
clc;
clearvars;
close all;
% Create sample data and row and column headers.
columnHeaders = {'n', 'Data Set #1', 'Data Set #2'};
for n=1:10,
rowHeaders{n} = sprintf('Row #%d', n);
tableData{n,1} = n;
tableData{n,2} = 10*rand(1,1);
tableData{n,3} = sprintf('Value = %.2f %s %.2f', rand(1,1), 177, rand(1));
end
% Create the table and display it.
hTable = uitable();
% Apply the row and column headers.
set(hTable, 'RowName', rowHeaders);
set(hTable, 'ColumnName', columnHeaders);
% Display the table of values.
set(hTable, 'data', tableData);
% Size the table.
set(hTable, 'units', 'normalized');
set(hTable, 'Position', [.1 .1 .8 .8]);
set(hTable, 'ColumnWidth', {40, 120, 180});
set(gcf,'name','Image Analysis Demo','numbertitle','off')

More Answers (1)

Matt J
Matt J on 4 Nov 2012
Edited: Matt J on 4 Nov 2012
Yes, but you would probably have to convert the other numeric data to type char, e.g.,
>> [num2str(5) ' ' char(177) ' ' num2str(4.5)]
ans =
5 ± 4.5
  2 Comments
Lily
Lily on 4 Nov 2012
Is it possible to constrct a matrix or a table with many numbers like 5+/-4.5?

Sign in to comment.

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!