Symbolic Matrix has extra blank row

When I do this:
>> syms b
>> C = [1 b; b 2]
C =
[1 b]
[ ]
[b 2]
The online example doesn't show this but I always get a blank row. What am I doing wrong? With all numbers, I get an ordinary matrix.

답변 (2개)

madhan ravi
madhan ravi 2018년 9월 4일
편집: madhan ravi 2018년 9월 4일

0 개 추천

OR TRY:
C = str2sym('[1 b; b 2]')
Edited after Sir walter‘s comment.

댓글 수: 10

madhan ravi
madhan ravi 2018년 9월 4일
I tried your code and it works fine for me.
madhan ravi
madhan ravi 2018년 9월 4일
if something is not clear let me know
madhan ravi
madhan ravi 2018년 9월 4일
Install symbolic toolbox.
madhan ravi
madhan ravi 2018년 9월 4일
Type ver in your command window and paste what shows here.
Walter Roberson
Walter Roberson 2018년 9월 4일
The above would not work in R2018a or later.
madhan ravi
madhan ravi 2018년 9월 4일
Oh that’s useful information @sir Walter thank you.
MATLAB warned for a number of releases about using sym() of anything that was not numeric or just the name of a variable. In R2017b, they finally provided str2sym() to convert expressions to symbolic. In R2018a, they disabled using sym() on expressions.
>> C = str2sym('[1 b; b 2]')
C =
[ 1, b]
[ b, 2]
madhan ravi
madhan ravi 2018년 9월 4일
That’s really useful information @sir Walter.
madhan ravi
madhan ravi 2018년 9월 4일
did it work @Carol Hurwitz?
madhan ravi
madhan ravi 2018년 9월 5일
편집: madhan ravi 2018년 9월 5일
If you find our (me and sir Walter‘s) answer useful please do accept my answer.

댓글을 달려면 로그인하십시오.

Carol Hurwitz
Carol Hurwitz 2018년 9월 4일

0 개 추천

I still get the same output, using your code. Is there a package I need to install?

댓글 수: 2

Carol Hurwitz
Carol Hurwitz 2018년 9월 5일
편집: Walter Roberson 2018년 9월 5일
I installed MATLAB at work today, with symbolic package, and it works perfectly. I reinstalled it at home and I get the same error as before.
C = [b 1 3 6; 2 4*b b 7; 0 3 5 1]
C =
[b 1 3 6]
[ ]
[2 4 b b 7]
[ ]
[0 3 5 1]
I am using different versions of Windows. At home I'm using 8.1, at work Win 10, both on 64 bit machines. It worked when I pulled it up on my iphone this afternoon.
Walter Roberson
Walter Roberson 2018년 9월 5일
Is it possible that you have Maple installed on the system that has the problem?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2018년 9월 4일

댓글:

2018년 9월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by