Uitable and vpa

Hi, I have problem with my code: vpa works for "result", but I need show result in the uitable1, but for "res" command vpa doesn't work.
matrix=[A B;C D]
a=simple(matrix\X);
b=sym(a)
result=vpa(b,4)
f=size(result);
for i=1:f(1);
for j=1:f(2);
res(i,j)=cellstr(char(result(i,j)));
end
end
set(handles.uitable1,'Data',res);
Please help

 採用された回答

Sean de Wolski
Sean de Wolski 2012 年 3 月 6 日

0 投票

Instead of char(result), use num2str() or sprintf()
doc num2str
doc sprintf
and for the comparison,
doc char

4 件のコメント

john
john 2012 年 3 月 6 日
sprintf
Function is not defined for 'sym' inputs.
did you mean clm(i,j)=num2str(uplne_vsetko(i,j),'%10.3e')???
PS: all matrix are created as cell matrix, then are converted with A(i,j)=sym(UserData.matrixA{i,j});
and then is result=vpa(b,4) .....
Sean de Wolski
Sean de Wolski 2012 年 3 月 6 日
Can you provide a sample: matrix, X?
john
john 2012 年 3 月 6 日
for pushbutton 1:
matrixX=cell(4,4);
for i=1:4
for j=1:4
maticaX{i,j}='0';
end
end
UserData.matrixX=matrixX;
for pushbutton 2:
vx=size(UserData.matrixX);
for i=1:vx(1);
for j=1:vx(2);
X(i,j)=sym(UserData.matrixX{i,j});
end
end
john
john 2012 年 3 月 6 日
it's works....:)
New question:
in case
martixA=zeros(4,4)
UserData.matrixA(1,1)=sym(strcat('-',(get(handles.edit5,'string'))));.....................
if string is number like 4.884032 it is ok, but in case if string is like "alfa", it is error,,,,,why???

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by