Filter löschen
Filter löschen

Creating new variables and matrix manipulation

1 Ansicht (letzte 30 Tage)
Amandeep
Amandeep am 9 Sep. 2011
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

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 9 Sep. 2011
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 Kommentare
Andrei Bobrov
Andrei Bobrov am 9 Sep. 2011
Index exceeds matrix dimensions in B
Amandeep
Amandeep am 9 Sep. 2011
Thanks for the reply

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by