Variables not showing up in the workspace

204 ビュー (過去 30 日間)
marianne
marianne 2021 年 4 月 9 日
コメント済み: Alexander Audet 2025 年 12 月 5 日 0:38
Hello, I have a problem with my Matlab 2019b installation.
If I type anything in the command window, for example a = 5, the variable and its content do not show up in the workspace.
If I right click in the workspace and select 'clear workspace', a window pops up telling me that the variables in the workspace will be deleted.. but the workspace is completely blank.
Do you know how to fix this? Thank you
  1 件のコメント
Tran
Tran 2025 年 5 月 10 日
You need to show the Workspace in the tab HOME go to Layout and tick the to show that workspace box. I think u need that.

サインインしてコメントする。

回答 (2 件)

Shadaab Siddiqie
Shadaab Siddiqie 2021 年 4 月 12 日
編集済み: Shadaab Siddiqie 2021 年 4 月 12 日
From my understanding variables are not visible to you in your workspace. It might be because you're working with function files rather than script files.
  • One of the key differences between scripts and functions is that "Functions have their own workspace, separate from the base workspace. Therefore, none of the calls to the function overwrite the values of the base workspace."
  • Scope of the variables which are defined in function, is limited to that function only.
  • Variables defined in function variables vanishes once function is exited.
  • To look at the function workspace you may want to add breakpoints in your code (click to the left of the code, but the right of the line number). Then you can step through your code with the function workspace.
  • If in case variables are visible to you in your workspace even when created in command window this might be because one of your script might be running and creating its workspace.
  • For now even when there are no variables in the workspace and you try to delete the variables in the workspace you get “variables in the workspace will be deleted” pop-up.
  3 件のコメント
Pranav Phanindra
Pranav Phanindra 2022 年 2 月 27 日
Hey Did you find the solution , I am also facing similar issues
Alexander Audet
Alexander Audet 2025 年 12 月 5 日 0:38
I third this. I can also type a defined variable into the command line and get the expected response, but nothing in the workspace window.

サインインしてコメントする。


Erik Hakopian
Erik Hakopian 2023 年 4 月 8 日
There is a bug in your code. That's the reason MATLAB is not running your code. Look at the command window to see where your bug is. Fix it and then you'll be able to execute your code and see the variables in the workspace.

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT Files についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by