How to name an array or series of arrays in a pattern?

조회 수: 5 (최근 30일)
Sukumar Palo
Sukumar Palo 2011년 2월 10일
I have around 10 variables and want to name the array according the variable.
e.g Variable 1 is '11234742' then the name will be Signal_11234742.
and when this variable comes again I should be able to put data into Signal_11234742.
How to do it.

답변 (3개)

Doug Hull
Doug Hull 2011년 2월 10일
Please do not do this!
See this question:

Igor
Igor 2011년 2월 10일
may be these commands give help 1) eval('...') 2) num2str
but more interesting: May one variable (allocated memory) have two names (used under 2 names)? In C/C++, as I know, this opportunity was indeed...
  댓글 수: 2
Khaled Khairy
Khaled Khairy 2011년 2월 10일
Yes. If you instantiate an object of a class that is derived from matlab's handle class.
Igor
Igor 2011년 3월 31일
please, give simple example... in code

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


Vieniava
Vieniava 2011년 2월 10일
var1=11234742;
prefix='Signal_';
eval([prefix num2str(var1) '=' num2str(var1)]);
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2011년 2월 10일
I would in general avoid this practice and use instead: Signal.s11234742 = variable

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by