Viewing variables after a script runs?

조회 수: 5 (최근 30일)
Kelly Cox
Kelly Cox 2020년 4월 16일
편집: Stephen23 2020년 4월 17일
I am trying to add some features to a 515 line script my boss wrote. I'm fairly new to Matlab, but I have figured out what I want to do--I just need to understand the variables he is using. (I'm trying to add standard error to a linear fit, using polyfitn).
For example, in this line of code on line 373:
[Fit_coeffsAve, S] = polyfit(DdateSR_rel, mean(RatioSR), 1);
I would like to see what values are in Fit_coeffsAve. And of course, once the script runs, the functions do not save data in the workspace. I've tried making that variable global--the entire script runs perfectly, but nothing is saved in the workspace. Thanks for any help you can provide!
  댓글 수: 3
Rik
Rik 2020년 4월 16일
Once you have done a Matlab tutorial you should understand why that is an inefficient method. And you should really re-read the documentation for global and never use it again until you do understand in.
Stephen23
Stephen23 2020년 4월 17일
편집: Stephen23 2020년 4월 17일
@Kelly Cox: rather than using evil GLOBAL variables, this is a good opportunity to start learning how to set a breakpoint to stop the code on/after that line. Then you can simply look at the variable, save it, print its values, etc.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by