Can someone please explain how to make this simple program from the Primer run - I am a beginner with MatLab
1 view (last 30 days)
Show older comments
nsamples=5;
npoints=50;
for k=1:nsamples;
iterationString = ['Iteration # ', int2str(k)];
disp(iterationString)
currentData = rand(npoints,1);
sampleMean(k) = mean(currentData);
end
overallMean = mean(sampleMean);
0 Comments
Answers (1)
Image Analyst
on 17 Dec 2015
On the Home tab or Editor tab of the tool ribbon, select New Script. Then paste it in to the new window it creates. Dock the window with the little down arrow on its title bar. You can grab its title bar and drag it to other docked locations if you want.
Then type F5 or else click the green Run triangle on the Editor tab of the tool ribbon.
I did it and it works fine with no errors or warnings at all.
2 Comments
Image Analyst
on 17 Dec 2015
Paste your code. It's not the code you originally pasted because that code runs perfectly.
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!