Newbie question

I'm new to Matlab, and I've just finished a set of calculations which gave me a final answer. Now I want to alter one of my earlier variables, so that I can see how it affects my final answer. I've tried 'edit value' on the value of the variable in question within the workspace - that does allow me to change the variable to a different value, but none of the other variables get updated, and my final result is still the same. I know it's going to be something simple....

 채택된 답변

Ken Atwell
Ken Atwell 2011년 11월 13일

0 개 추천

You may be used to Excel, where a change in the value of an input variable "cascades" throughout the spreadsheet.
In MATLAB, after changing the value of your input variable, you need to reissue your other assignments to get to a new final answer. Up-arrow will let you scroll through your command history, so you don't need to retype the calculations. If you get tired of even doing this, you'll want to capture your calculation into a file (a MATLAB script) that you can run again and again as a single MATLAB command.

댓글 수: 3

Tom
Tom 2011년 11월 13일
Okay thanks that explains things. How do I go about making a script?
Ken Atwell
Ken Atwell 2011년 11월 13일
There is a good five-minute primer at http://www.mathworks.com/support/2011b/matlab/7.13/demos/WritingAMATLABProgram.html
Tom
Tom 2011년 11월 13일
Thanks that helped a lot

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

Tom
2011년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by