How to put Hex numbers inside a matrix?
조회 수: 4 (최근 30일)
이전 댓글 표시
I'm trying to put some Hex numbers inside a matrix. That's my code:
-----------------------------
>> syms matrix
>> matrix(1,1)='c080'
matrix =
c080
-----------------------------
>> matrix(1,2)='a9faee80'
matrix =
[ c080, a9faee80]
-----------------------------
>> matrix(1,3)='1f00'
Here the Error occurs and i don't know why!
I'll be so thankful for any kind of help!
-----------------------------
Error Message:
Error using sym>convertExpression (line 2246) Conversion to 'sym' returned the MuPAD error: Error: Unexpected 'identifier'. [line 1, col 2]
Error in sym>convertChar (line 2157) s = convertExpression(x);
Error in sym>convertCharWithOption (line 2140) s = convertChar(x);
Error in sym>tomupad (line 1871) S = convertCharWithOption(x,a);
Error in sym (line 104) S.s = tomupad(x,'');
Error in sym/subsasgn (line 1613) if ~isa(B,'sym'), B = sym(B); end
댓글 수: 0
답변 (1개)
Jan
2013년 7월 10일
편집: Jan
2013년 7월 10일
With "syms" the created matrix is symbolic, then it contains symbolic variables. The names of these variables must follow the standard rules of Matlab: less than 64 characters, only letters, numbers and the underscore, but the first character must be a letter. Therefore 'c080' is valid, while '80c0' is not.
What do you want to achieve? Hexadecimal values are stored as strings, so you either need a cell string or perhaps storing the values in the usual decimal format is the most direct solution. But syms seems to be not sufficient for the job.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!