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 From the coding above, the answer become like this : [11.75 11.25 11.25 11.75 10.75 11.5 12.75 12.75 13] My question is I want to display my answer at the static text box like this: P1 = (%answer for P1) P2 = (%answer for P2) P TOTAL = (%answer for PT) Can anyone help me with the coding?
Prashant Kumar answered .
2025-11-20
You can build the multiline text, for example:
{['P1 =' string1],['P2 =' string2],['P3 =' string3]}