Editing structure fields using a MATLAB App

조회 수: 15 (최근 30일)
Marc Arriola
Marc Arriola 2022년 8월 11일
댓글: Marc Arriola 2022년 8월 12일
Currently I am working on a project that requires an easy and user-friendly access to different variables, for this reason I am developing an app that simply allows to modify variables on the base workspace. The problem appears when structure fields are added, the assignin function prompts an error:
Error using assignin
Invalid variable name "Struct.Variable" in ASSIGNIN.
I would like to implement a method that can automatically evaluate all the variables in the base workspace preferably without using an auxiliary file. Furthermore I would also like to change the default values shown in the app layout whenever the values are changed using the Edit Field.
Thanks in advance

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 11일
assignin() can only assign to complete un-indexed variables.
You will need to load the current struct into your workspace, modify the field, and assignin() the entire struct.
  댓글 수: 1
Marc Arriola
Marc Arriola 2022년 8월 12일
Thanks for your answer, it worked perfectly as expected.

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by