Uitable- symbolic variable
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I want use uitable, and uitable should present matrix named for example a. I need insert numbers ” 1, 2, 3,…” and strings “a, b,c,….” to the table.
At the end I need result b=a*a.
Please, help mi.
PS:
Here is example in M-file. i3 = sym(‘i3′,’real’); a=[ 0 0 i3; 1 2 3]; b=[2 2; 2 2; 2 2]; c=a*b;
But I need something like this in GUIDE.
0 个评论
回答(1 个)
Walter Roberson
2011-10-26
I am not clear on what you are asking to do. Are you asking to be able to write symbolic formula in to the cells, and evaluate the formula represented by the cells?
If so, and if each symbolic variable has an associated actual value (or list of values), then you can use vectorize() and str2func() to convert the text strings in to anonymous functions that you can then pass the relevant values in to. (If you want to build an Excel replacement, you will likely find bsxfun() or ndgrid() to be useful.)
If, though, one or more of the symbols might not have an associated actual value and you want the result to be computed with numeric values used when possible and symbols used where appropriate, then you are going to have to write your own symbolic expression handler (or find one that someone has already written.)
4 个评论
Walter Roberson
2011-10-26
You will have to change all of your cells to be text, and expect text representation of numbers. str2double() of a string will return empty if the string does not represent a pure number.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!