Reputation: 107
I use a function which may return outputs more than 3 or 4 which makes it hard to assign those numbers / matrices to user defined variables one by one. Here is the example:
k = fix(log2(length(s)))
[c,l] = wavedec(s,k,'db1');
[cd1,cd2,cd3, ... , cdk] = detcoef(c,l,1:k);
k is 22 in this example. How can I get those outputs by not writing all cd's from 1 to 22?
Upvotes: 0
Views: 56
Reputation: 19689
Don't create those dynamic variables. Just use:
D = detcoef(c,l,1:k);
This will create a cell array having the same contents as of cd1
, cd2
, ..., cdk
at its 1st, 2nd, ..., kth index respectively. Access them using D{1}
, D{2}
,..., D{k}
respectively.
Upvotes: 1