Can someone please explain how to make this simple program from the Primer run - I am a beginner with MatLab

1 次查看(过去 30 天)
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);

回答(1 个)

Image Analyst
Image Analyst 2015-12-17
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 个评论
Robert Booth
Robert Booth 2015-12-17
Thank you very much. I followed your instructions which are helpful but came across the same difficulty as I had been experiencing and this is the line I could not solve - Subscript indices must either be real positive integers or logicals. Can you please tell me how to do this?Many thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by