Azzera filtri
Azzera filtri

Display mean +/- std in a table or matrix

16 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Image Analyst
Image Analyst il 5 Nov 2012
Modificato: Image Analyst il 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')

Più risposte (1)

Matt J
Matt J il 4 Nov 2012
Modificato: Matt J il 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 Commenti
Lily
Lily il 4 Nov 2012
Is it possible to constrct a matrix or a table with many numbers like 5+/-4.5?
Matt J
Matt J il 4 Nov 2012
Of course!

Accedi per commentare.

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by