필터 지우기
필터 지우기

Calling variables instead of values

조회 수: 2 (최근 30일)
Will
Will 2011년 10월 31일
I have this:
A=1; B=2; C=3;
x = [2 3 1]
I want to call x1 as:
x1 =
B C A
I can call individual values, but I don't know how to call them as variables.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 10월 31일
xc = num2cell(x)
[B C A]= xc{:}
ADD
x = [2 3 1]
xc = {'A' 'B' 'C'}
x1 = xc(x)
  댓글 수: 2
Will
Will 2011년 10월 31일
I don't think that's what I'm looking for.
I need to associate A, B and C to [2 3 1] and output [B C A]
And also, I was using 2 3 1 and B C A as an example. I must take in many more numbers if needed.
Jan
Jan 2011년 10월 31일
@Will: What does "[B C A]" exactly mean? Is it a cell string, a string or a symbolic expression?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by