You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Hva skrives ut hvis vi kjører scriptet «oppgave_2.m»?

oppgave_2.m
x = [ '0':'9', 'A':'Z', 'a':'z' ]
fprintf('%3c ', x);
fprintf('\n');
fprintf('%3d ', x);
fprintf('\n');
length('a':'å')
double(['æ', 'ø', 'å']) 

Videoforklaring (mm:ss)

Del 1 (mm:ss)Del 2 (mm:ss)Del 3 (mm:ss)
 

Generelt om bokstaver som tall, og bruk av
kolon-operasjonen med bokstaver.

Fprintf med bokstavverdier tolket som tall. 

Svar

x =
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   a   b   c   d   e   f   g   h   i   j   k   l   m   n   o   p   q   r   s   t   u   v   w   x   y   z 
 48  49  50  51  52  53  54  55  56  57  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 
ans =
   133
ans =
   230   248   229
  • No labels