【发布时间】:2011-06-26 12:27:59
【问题描述】:
嘿家伙。可以帮帮我吗?
if size(cost,1) == 2
A = (4*Pdt*cost(1,3)*cost(2,3)) + 2*(cost(1,2)*cost(2,3))+(cost(1,3)*cost(2,2));
B = 2*(cost(2,3)+cost(1,3));
lambda = num2str(A ./ B);
set(handles.answer1_staticText,'String', lambda);
P1 = (lambda - cost(1,2))./(2*cost(1,3));
P2 = (lambda - cost(2,2))./(2*cost(2,3));
PT = mat2str(P1 + P2);
set(handles.answer2_staticText,'String', PT);
guidata(hObject, handles);
end
从上面的编码,答案变成了这样:
[11.75 11.25 11.25 11.75 10.75 11.5 12.75 12.75 13]
我的问题是我想在静态文本框中显示我的答案,如下所示:
P1 = (%answer for P1)
P2 = (%answer for P2)
P TOTAL = (%answer for PT)
谁能帮我写代码?
【问题讨论】:
-
您需要确保最终结果是标量,而不是矩阵。
标签: arrays user-interface matlab matrix