Effacer les filtres
Effacer les filtres

Display mean +/- std in a table or matrix

16 vues (au cours des 30 derniers jours)
Lily
Lily le 4 Nov 2012
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.

Réponse acceptée

Image Analyst
Image Analyst le 5 Nov 2012
Modifié(e) : Image Analyst le 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')

Plus de réponses (1)

Matt J
Matt J le 4 Nov 2012
Modifié(e) : Matt J le 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 commentaires
Lily
Lily le 4 Nov 2012
Is it possible to constrct a matrix or a table with many numbers like 5+/-4.5?
Matt J
Matt J le 4 Nov 2012
Of course!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by