Please help me on this problem!! I need help with uitable!!!

조회 수: 1 (최근 30일)
slumberk
slumberk 2011년 3월 7일
Hye guyz. Hope you guyz can help me on this. I have two figures of table.
One table is call H and another one call C. Both table is 4 by 3 table.
So if the user insert a value in two edit box. For example:
A = value B = value
Then the user insert the data in H table. The user only use 2 rows. Let say this is the data:
ALPHA BETA GAMMA
H1
H2
H3
H4
So the user want to get the subset of H1 and multiply with A and subsets of H2 multiply with B. This is how it will be:
C1 = (ALPHA VALUE)*A (BETA VALUE)*A (GAMMA VALUE)*A
C2 = (ALPHA VALUE)*B (BETA VALUE)*B (GAMMA VALUE)*B
Then the user wants to display the answer on C table where it will become like this:
ALPHA BETA GAMMA
C1 NEW VALUE NEW VALUE NEW VALUE
C2 NEW VALUE NEW VALUE NEW VALUE
C3
C4
How can i make the coding of this problem?
I have already try this coding but it seems i failed. CAN ANYONE HELP ME PLEASE!!
H = cell2mat(get(handles.Mytable3,'Data'));
cost1 = str2num(get(handles.input2_editText,'String'));
cost2 = str2num(get(handles.input3_editText,'String'));
H1 = H(1,:)*cost1;
H2 = H(2,:)*cost2;
H = mat2cell([H1 H2]);
cost = get(H,'Data');
set(handles.Mytable2,'Data',cost)

채택된 답변

Matt Tearle
Matt Tearle 2011년 3월 7일
H = mat2cell([H1;H2]);
(vertical concatenation, not horizontal)
  댓글 수: 3
Matt Tearle
Matt Tearle 2011년 3월 7일
No. H is a cell array, not a handle (so get will not work -- what would it get anyway?). Delete that line and change "cost" to "H" in the next line.
slumberk
slumberk 2011년 3월 7일
it works!! thx

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by