MATLAB Answers

Can I save variables to the workspace to view them before the script generating them ends?

1 ビュー (過去 30 日間)
Blake Conka
Blake Conka 2019 年 8 月 22 日
コメント済み: Blake Conka 2019 年 8 月 22 日
I have a script that runs functions that generate structures on a dataset I'm working on, then plots values from the fields of those structures by a user input of the names of those fields. Is there a way for me to view what the fields are so I can make sure to input them correcly into my plot function before the script terminates?

  0 件のコメント

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

採用された回答

AdamG2013468
AdamG2013468 2019 年 8 月 22 日
You could just add the struct comewhere in your script without supressing with a semi-colon so it prints to the command window. For example, if your struct 'A' has fields 'tree', 'cat', 'house', then just include:
A
so it prints something like,
A =
struct with fields:
tree:
cat:
house:
Am I understanding your question?

  1 件のコメント

Blake Conka
Blake Conka 2019 年 8 月 22 日
This works. I was trying to keep my command window looking clean, but simple is probably better. Thanks!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by