Store output in array

2 views (last 30 days)
dhhtr
dhhtr on 21 Apr 2015
Commented: Star Strider on 21 Apr 2015
Hi everyone,
For the randomly generated points, I would like to store the output of 'position' as an array such that I can make reference to it in future.
I know this can be done when using a for loop, but is it possible to accomplish without the need of manually entering each result as a vector?
Any help would be kindly appreciated.
r=3;
m=10;
x=rand(1,m)*r;
alpha=pi*2*rand(1,m);
position=x.*exp(i*alpha)
Cheers.

Accepted Answer

Star Strider
Star Strider on 21 Apr 2015
Your ‘position’ vector is a vector in your code.
What do you want to do with it?
  4 Comments
dhhtr
dhhtr on 21 Apr 2015
Great! Thanks for the options, Star. I haven't come across the rng function before. It looks interesting - I will try it out.
Really appreciate the help. Have a nice day.
Star Strider
Star Strider on 21 Apr 2015
My pleasure!
You, too!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!