필터 지우기
필터 지우기

Uitable- symbolic variable

조회 수: 3 (최근 30일)
john
john 2011년 10월 25일
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.

답변 (1개)

Walter Roberson
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
john
john 2011년 10월 26일
Sorry, number of columns and rows
Walter Roberson
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 CenterFile 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!

Translated by