필터 지우기
필터 지우기

Creating new variables and matrix manipulation

조회 수: 1 (최근 30일)
Amandeep
Amandeep 2011년 9월 9일
Hi,
From:
A = 9
[55;61;66;68]
20
60
[47;83;105]
72
[44;57];
B = [1;2;5;6;8;9;10];
I am trying to create matrices with names that look like:-
A1 = [9];
A2 = [55;61;66;68];
A5 = 20
A6 = 60
A8 = [47;83;105]
A9 = 72
A10 = [44;57];
Any help will be fanatastic. Thanks

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 9월 9일
Do not do it.
Read the FAQ
only for theory!!!
inital:
A = {9
[55;61;66;68]
20
60
[47;83;105]
72
[44;57]};
B = [1;2;5;6;8;9;10];
soltion
for i1 = numel(B):-1:1
eval(['A',num2str(B(i1)),'=A{',num2str(i1),'}']);
end
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2011년 9월 9일
Index exceeds matrix dimensions in B
Amandeep
Amandeep 2011년 9월 9일
Thanks for the reply

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by