Complete the code to check if variable x is of class 'double'.
if [1](x, 'double') disp('x is a double'); end
The isa function checks if a variable is of a specified class.
Complete the code to get the class name of variable y.
typeName = [1](y);The class function returns the class name of a variable as a string.
Fix the error in the code to check if z is a cell array.
if [1](z, 'cell') disp('z is a cell array'); end
To check if a variable is a cell array, use isa with 'cell'.
Fill both blanks to create a dictionary of variable names and their classes for variables in the list.
vars = {'a', 'b', 'c'};
classes = containers.Map();
for i = 1:length(vars)
varName = vars{i};
classes(varName) = [1](eval([2]));
endUse class to get the class name of the variable whose name is stored in varName.
Fill all three blanks to check if each variable in the list is of class 'double' and store the result in a logical array.
vars = {x, y, z};
isDouble = false(1, length(vars));
for k = 1:length(vars)
isDouble(k) = [1](vars[2], '[3]');
endUse isa to check if each variable is 'double'. The variable is accessed as vars{k}.
