MATLAB - String Handling
What is the output of the following MATLAB code?
str = "MATLAB"; charArr = 'MATLAB'; disp(class(str)); disp(class(charArr));
str = "MATLAB"; charArr = 'MATLAB'; disp(class(str)); disp(class(charArr));
str is created with double quotes, so it is a string type. Variable charArr uses single quotes, so it is a character array (char).class() outputclass() function returns the type name as a string. So class(str) returns 'string' and class(charArr) returns 'char'.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions