Format bank uitable

Hi,
please for help.
How can I set up format short or format bank for my program for uitable? I still have format long, but I need form short.
Maybe problem is cell... maticaA=cell(3,3);....but I will need it later to insert numbers and strings into table uitable1.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
h=findobj(0,'Type','figure','Tag','figure1');
UserData=get(h,'UserData');
format bank;
maticaA=cell(3,3);
for i=1:3
for j=1:3
maticaA{i,j}='0.02545455454';
end
end
UserData.maticaA=maticaA;
columneditable(1:3)=true;
set(handles.uitable1,'Data',maticaA,'ColumnEditable', columneditable,'ColumnWidth',{40},'visible','on');
va=size(UserData.maticaA);
for i=1:va(1)
for j=1:va(2)
A(i,j)=sym(UserData.maticaA{i,j});
end
end
C=simple(A);
vys=size(C);
for i=1:vys(1)
for j=1:vys(2)
vysledok(i,j)=cellstr(char(C(i,j)));
end
end
set(handles.uitable12,'Data',vysledok,'ColumnFormat',{'bank','bank','bank'},'ColumnEditable', columneditable,'ColumnWidth',{150},'visible','on');
set(h,'UserData',UserData);
guidata(hObject, handles);

Antworten (2)

Jan
Jan am 14 Jan. 2012

1 Stimme

It looks like you actually use the 'bank' ColumnFormat already.
See:
uitable('Data', {1.234567890, 1.234567890, 1.234567890, single(1.234567890)},...
'ColumnName', {'long', 'numeric', 'bank', 'numeric'},...
'ColumnFormat', {'long', 'numeric', 'bank', 'numeric'}, ...
'Units','normalized','Position', [0.1 0.1 0.9 0.9]);

3 Kommentare

john
john am 14 Jan. 2012
ok....so what is wrong with my code? I want to set format bank in my code...but how?
Walter Roberson
Walter Roberson am 14 Jan. 2012
"format bank" applies to numeric values. You do not store numbers in either of your uitables: you store strings.
maticaA{i,j}='0.02545455454'
is a string.
vysledok(i,j)=cellstr(char(C(i,j)));
stores a string at vysledok{i,j}
john
john am 14 Feb. 2012
So...how can I store value "sym" into uitable?

Melden Sie sich an, um zu kommentieren.

Walter Roberson
Walter Roberson am 14 Jan. 2012

0 Stimmen

uitable only supports two numeric formats,, 'numeric', and 'bank'. There is no possibility to change what either of those formats looks like.
If you need anything more specific, you need to make that column a string and format the numbers as string yourself (and remembering to convert back to numeric if you ever need to fetch them.)

2 Kommentare

john
john am 14 Jan. 2012
1. I'm not sure...can I change format in my program ( durning calculation of my program?
2. You wrote "supports two numeric formats,, 'numeric', and 'bank' " ...So can I have format bank? because I want format bank
Walter Roberson
Walter Roberson am 14 Jan. 2012
My mistake, anything acceptable to the "format" command can be used.
'short' and 'bank' are acceptable.
http://www.mathworks.com/help/techdoc/ref/uitableproperties.html#brglhyc

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 14 Jan. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by