0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.