how to fetch data from table?

hello, i want to fetch data from two tables. i created the tables but i dont know how to fetch the datas.
function [z] = pushbutton1_Callback(hObject, eventdata, handles)
global nbb
global ntl
global ngn
global t1
a=findobj(gcbf,'TAG','edit1'); % bus say?s? girdigimiz text'i a'ya atad?k.
b=findobj(gcbf,'TAG','edit2'); % hat sayisi girdigimiz text'i b'ye atad?k.
c=findobj(gcbf,'TAG','edit3'); % jeneratör say?s? girdigimiz text'i c'ye atad?k.
bs=get(a,'string');
hs=get(b,'string');
gs=get(c,'string');
nbb=str2num(bs)
ntl=str2num(hs)
ngn=str2num(gs)
data = zeros(nbb,12);
edit=true(1:nbb);
colnames = {'BUS NO', 'BUS CODE','VOLTAGE MAG.','ANGLE DEG.','LOAD(MW)','LOAD(MVAR)','GEN(MW)','GEN(MVAR)', 'GEN Qmin','GEN Qmax','SHUNT RES.','SHUNT REAC'};
t1 = uitable('Data', data, 'ColumnName', colnames, 'ColumnEditable',edit, ...
'Position', [100 240 720 100])
linedata = zeros(ntl,6);
editbir=true(1:ntl);
colnames = {'SEND', 'RECEIVE','RESIS','REAC','COND','SUSCEP'};
t2 = uitable('Data', linedata, 'ColumnName', colnames, 'ColumnEditable',editbir, ...
'Position', [100 100 500 100]);

 채택된 답변

Elif
Elif 2011년 4월 4일

0 개 추천

thanks a lot. but i solved the problem by using uitable from guide. but now i have another problem. i get matris from table using cell2mat function.
H = cell2mat(get(handles.uitable3,'Data')); i use the matris as an input at another function and i get this error.
Undefined function or method 'H' for input arguments of type 'double'.

댓글 수: 5

Walter Roberson
Walter Roberson 2011년 4월 4일
Are you retrieving H in one routine and using it in a different routine? That will not usually work. See the FAQ on alteratives,
http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
Elif
Elif 2011년 4월 6일
i can't fetch double from cell. i have a problem with cell2mat function.
>> X={'1.2'};
>> y=cell2mat(X)
y =
1.2
>> size(y)
ans =
1 3
>> y(1,1)
ans =
1
Walter Roberson
Walter Roberson 2011년 4월 6일
y = str2double(X{1});
Elif
Elif 2011년 4월 6일
is there another way for it? if the cell dimension increase str2double does not work.
Walter Roberson
Walter Roberson 2011년 4월 6일
str2num()

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2011년 4월 3일

1 개 추천

data1 = get(t1,'Value');
Then use cell array indexing to access the elements.
Elif
Elif 2011년 4월 8일

0 개 추천

thanks for everything.

카테고리

제품

질문:

2011년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by