[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Octave should be more consistent in converting automatically char to num
From: |
Dildar Sk |
Subject: |
Octave should be more consistent in converting automatically char to numeric. |
Date: |
Mon, 26 Mar 2018 01:23:26 -0700 (MST) |
In MATLAB,
>> sind('334')
Undefined function 'sind' for input arguments of type 'char'.
>> cosd('2')
Undefined function 'cosd' for input arguments of type 'char'.
>> tand('HelLO WorLD')
Undefined function 'tand' for input arguments of type 'char'.
>> deg2rad('1')
Error using deg2rad (line 13)
Input must be single or double.
>> rad2deg('ok')
Error using rad2deg (line 13)
Input must be single or double.
So,most of the times MATLAB chooses not to automatically convert char value
to numerical.
But in Octave,
>> sind('334')
ans =
0.77715 0.77715 0.78801
>> cosd('2')
ans = 0.64279
>> tand('HellO wOrLD')
ans =
Columns 1 through 6:
3.07768 -5.14455 -3.07768 -3.07768 5.14455 0.62487
Columns 7 through 11:
-1.80405 5.14455 -2.24604 4.01078 2.47509
>> deg2rad('1')
error: deg2rad: DEG must be a floating point class (double or single)
error: called from
deg2rad at line 49 column 5
>> rad2deg('ok')
error: rad2deg: RAD must be a floating point class (double or single)
error: called from
rad2deg at line 49 column 5
So, Octave sometimes choose to convert char value to numeric and sometimes
simply throws
error. So, I think Octave should be little more consistent in automatic
conversion.
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- Octave should be more consistent in converting automatically char to numeric.,
Dildar Sk <=