Filter löschen
Filter löschen

Uitable- symbolic variable

3 Ansichten (letzte 30 Tage)
john
john am 25 Okt. 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.

Antworten (1)

Walter Roberson
Walter Roberson am 26 Okt. 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 Kommentare
john
john am 26 Okt. 2011
Sorry, number of columns and rows
Walter Roberson
Walter Roberson am 26 Okt. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by