octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indexing with "string" values in Matlab


From: Richard Crozier
Subject: Re: Indexing with "string" values in Matlab
Date: Fri, 25 Oct 2013 17:47:53 +0100
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 25/10/2013 17:33, John W. Eaton wrote:
On 10/25/2013 12:11 PM, Michael D. Godfrey wrote:

 >> y('ADBC') = '1234'

y =

1342

Though it doesn't show in the quoted message above (stupid mailer) in
the original message it looked like the string was padded with blanks.
Is that correct?  What does

   clear y
   y('adbc') = '1234';
   abs (y)

show?  Does it fill with blanks (ASCII 32)?  Octave fills with 0 and
then doesn't display the NUL character.

jwe




from before:

>> whos
  Name      Size             Bytes  Class     Attributes

  ans       1x4                 32  double
  x         1x100              800  double
  y         1x68               136  char

>> fprintf(1, '%d', y)
00000000000000000000000000000000000000000000000000000000000000004951525

>> clear y
  y('adbc') = '1234';
  abs (y)

ans =

  Columns 1 through 7

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 8 through 14

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 15 through 21

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 22 through 28

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 29 through 35

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 36 through 42

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 43 through 49

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 50 through 56

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 57 through 63

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 64 through 70

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 71 through 77

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 78 through 84

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 85 through 91

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000

  Columns 92 through 98

0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 0.0000e+000 49.0000e+000 51.0000e+000

  Columns 99 through 100

    52.0000e+000    50.0000e+000


Richard

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]