Uitable- symbolic variable

2 views (last 30 days)
john
john on 25 Oct 2011
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.

Answers (1)

Walter Roberson
Walter Roberson on 26 Oct 2011
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 Comments
john
john on 26 Oct 2011
Sorry, number of columns and rows
Walter Roberson
Walter Roberson on 26 Oct 2011
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.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!