Assignin Structures

조회 수: 19 (최근 30일)
Brandon
Brandon 2012년 4월 1일
Greetings -
I created a structure within a function and I would like to save it back to the base work space and I get the error:
"??? Undefined function or method 'assign' for input arguments of type 'struct'."
What is a good way of getting around assignin and structures. I have the structure named 'data' and I would like to save everything it contains to the base work-space.

답변 (3개)

the cyclist
the cyclist 2012년 4월 1일
Well, the error refers to the function or method "assign" and not "assignin". Is it possible you made a simple typo? Can you show the actual code you used?

Image Analyst
Image Analyst 2012년 4월 1일
Assuming you really used assignin() and not assign() (of which there is no such function), are you sure you did something like
assignin('base', 'myStruct', myStruct);
Maybe you forgot to put the name of your structure variable in there twice, once with single quotes around it.

Brandon
Brandon 2012년 4월 1일
My apologies. I feel like I would be a significantly better programmer if I could spell, or spell or at least consistently wrong. I was using assign rather then assignin. Not sure how I got to this point without noticing.
  댓글 수: 1
the cyclist
the cyclist 2012년 4월 1일
No worries. Sometimes the silliest errors are the most difficult ones to spot. Please consider "accepting" my solution to you problem, since it does seem to have resolved the issue. Also, for future reference, it might have made sense to add your remarks as a "comment" to my answer, rather than as a separate "answer".

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by