MATLAB Answers

How to create a structure with a name speficied by user in inputdlg?

1 view (last 30 days)
Flávio
Flávio on 6 Feb 2013
So I ask what is the name of the structure in an inputdlg, the result is a cell array. The field is named always 'Course' and I want to create a structure named specifiedname.Course=[].
Is it possible to do?

  1 Comment

Image Analyst
Image Analyst on 6 Feb 2013
Why would you want to do that? It would just complicate your program, though I think you can do it with dynamic structure names, but again, it's just unnecessary complication.

Sign in to comment.

Answers (1)

Dan K
Dan K on 6 Feb 2013
Folks, please don't crucify me for this one, but the easiest way I see to do it is:
eval([specifiedname '.Course = []']);

  0 Comments

Sign in to comment.

Sign in to answer this question.