How to output class property so that it can be accessed in MATLAB's terminal? In my case, ClassA
stores p
array and shows output like:
ClassA with properties:
p: [3x3 double]
But when I want to access the array, its always says undefined function or variable. Although its public
.
My Code:
classdef Input
properties
p
end
methods
function obj = Input()
[obj.p] = input('Enter array like [a b c; d e f;]');
end
end
end
You probably need to clear all instances of Input
classes and rehash
your path to update the definition of the class.
I get:
>> myIn = Input;
Enter array like [a b c; d e f;][1 2 3; 4 5 6]
>> myIn
myIn =
Input with properties:
p: [2x3 double]
>> myIn.p
ans =
1 2 3
4 5 6