3
a = 0;
b = 0;
c = 0;

Can I do this in one statement without using an array/vecor?

1 Answer 1

9

I would try using the deal function.

http://www.mathworks.com/help/matlab/ref/deal.html

      [a,b,c] = deal(0,0,0);

There are other ways, but this is a good function to learn.

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

1 Comment

You can also do [a,b,c] = deal(0); as explained here.

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.