Bird
0
0

What will be the output of this MATLAB code?

medium📝 Predict Output Q5 of 15
MATLAB - Cell Arrays and Structures
What will be the output of this MATLAB code?
strVal = '123.45'; numVal = str2double(strVal); disp(class(numVal));
A'char'
B'string'
C'double'
D'int32'
Step-by-Step Solution
Solution:
  1. Step 1: Convert string to number

    str2double() converts string to numeric double type.
  2. Step 2: Check class of result

    class(numVal) returns the data type, which is 'double'.
  3. Final Answer:

    'double' -> Option C
  4. Quick Check:

    str2double output type = 'double' [OK]
Quick Trick: str2double() returns double numeric type [OK]
Common Mistakes:
  • Expecting 'char' or 'string' output
  • Confusing class() output
  • Using int32 instead of double

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes