Store output in array

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.

 采纳的回答

Star Strider
Star Strider 2015-4-21

0 个投票

Your ‘position’ vector is a vector in your code.
What do you want to do with it?

4 个评论

Hi Star,
Thanks for your comment.
I would like to store the initial set of data generated so I can recall it for later as each time I run the code, it gives me new results - I'm just interested in the first set of outputs.
Thanks again.
My pleasure.
In that instance, you have two options:
1. Sstore it as a .mat file (probably easiest, see the save, load, and matfile functions), or
2. Set the random number generator with a specific seed (see the rng function) each time you run that particular part of your code.
As always, my pleasure.
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.
My pleasure!
You, too!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by