what is difference between 124567891234567 vector and [1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7] vector? how to convert 1234567891234567 vector into [1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7]?

2 views (last 30 days)
matrix formed by 123456789 look like this
1234;
5678;
9123;
4567;
while matrix formed by
[1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7]
look like
1 2 3 4;
5 6 7 8;
9 1 2 3;
4 5 6 7;
in first case bitwisexor and xor results are not true
  1 Comment
per isakson
per isakson on 21 Oct 2017
1234567891234567
looks like a string array and
[1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7]
looks like a numerical vector. Is that what you mean?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 21 Oct 2017
The first one looks to me as if it would have been entered as '1234567891234567'. it looks to me as if the operation is
output = reshape(M, 4, 4).'
We do not know how the bitwise tests were coded.
'1234567891234567' is exactly the same in MATLAB as
['1' '2' '3' '4' '5' '6' '7' '8' '9' '1' '2' '3' '4' '5' '6' '7']
MATLAB uses 16 bit Unicode code points internally to represent characters. '1' is a character; its printed representation in any given font is a glyph https://glyphsapp.com/tutorials/unicode. What you see is the glyph, the picture representing the character; after parsing, '1' is the character, which is something that has particular meaning attached to it. The internal representation of the character associated with '1' is not the integer 1: it is the integer 49. ['1' '2' '3' '4' '5' '6' '7' '8' '9' '1' '2' '3' '4' '5' '6' '7'] in MATLAB is uint16([49 50 51 52 53 54 55 56 57 49 50 51 52 53 54 55]) but marked to be interpreted as character.
If you look at the history of mechanical alphabets such as https://en.wikipedia.org/wiki/Baudot_code you will see that historically the codes never used integer 0 for character '0', integer 1 for character '1' and so on. The codes were designed around matters such as operator fatigue and mechanical wear.

Categories

Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!