Reputation: 901
I have got 2 variables
A of value <240x500 double>
and
B of value <1x500 cell>
How can I declare another 2 variables
C of type A
and
D of type B
?
Upvotes: 0
Views: 213
Reputation: 1274
You don't have to define variable types in Matlab. To declare C
and D
, simply do the following:
C = zeros(240,500);
D = cell(1,500);
This will create new matrices of the same sizes of A
and B
. C
will be filled with 0
's and D
will be an empty cell matrix. If you would prefer the new matrices to be initialized to some other value, you could do use the ones()
function instead:
x = 100;
C = ones(240,500) * 100;
This will populate the C
matrix with 100
's
Upvotes: 1