How to see global variable in workspace?

조회 수: 47 (최근 30일)
binh23294
binh23294 2020년 9월 27일
댓글: binh23294 2020년 9월 28일
I have global variables p in GUI Matlab. When I run GUI, I only see variable p in command windows but i don't see it in workspace? Please help me! Thanks so much!

채택된 답변

Image Analyst
Image Analyst 2020년 9월 27일
You need to declare it before you need to use it inside the function where you need to use it.
It looks like p is in your workspace but that might be a different p. Did you use or create a p before you called the global line? The warnings you see tell you that if you use global, it should be the first line in your function. So somehow I think your p is not the global one you thought, but is instead a local p. Is your global p a table or cell array. What does this show:
whos p
Are you stopped at a breakpoint? I think that workspace is not the one corresponding to the code. For example in your code is a variable SoilTypeState but that does not show up in your workspace panel so the workspace panel doesn't seem like it corresponds to the code you are showing, so that's why I think maybe you're stopped at a breakpoint in a different function and then just scrolled down past that to line 325.
  댓글 수: 1
binh23294
binh23294 2020년 9월 28일
I had to put a breakpoint at 336 line and i saw p in workspace. Thanks for help!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by