필터 지우기
필터 지우기

Display mean +/- std in a table or matrix

조회 수: 16 (최근 30일)
Lily
Lily 2012년 11월 4일
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.

채택된 답변

Image Analyst
Image Analyst 2012년 11월 5일
편집: Image Analyst 2012년 11월 5일
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')

추가 답변 (1개)

Matt J
Matt J 2012년 11월 4일
편집: Matt J 2012년 11월 4일
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
Lily
Lily 2012년 11월 4일
Is it possible to constrct a matrix or a table with many numbers like 5+/-4.5?
Matt J
Matt J 2012년 11월 4일
Of course!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by