I have 2 matrices
A and B and 100 rows and 42 columns,now i want 1st row of A and B matrices to be stored in an variable named firstcombination,2nd row of A and b matrices to be stored as secondcombination and so on,please help

댓글 수: 1

Walter Roberson
Walter Roberson 2012년 1월 30일
Do you need to _store_ the combinations one by one in to individual variables each of which includes the combination number? Or do you need to _output_ the combinations to the display?

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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 1월 30일

0 개 추천

try this is code:
combinations = permute(cat(3,A,B),[3 2 1]);
your 1st combination:
combinations(:,:,1)
your 2nd combination:
combinations(:,:,2)
ets

댓글 수: 1

kash
kash 2012년 1월 30일
thanks andrei ,as i mentioned i have matrices of 100X6
so for every combination is there any for loop to procees as u said,because i have to write till 100 combination
combinations(:,:,1)
;
;
;
combinations(:,:,100)
is there any foor loop to perform these operation

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 1월 29일

0 개 추천

댓글 수: 2

kash
kash 2012년 1월 30일
but walter io did not get as i desired
for ex A=[1 2 3 ;8 9 10]
B=[10 25 69;58 98 75 ]
i need output as
1stcombination=[1 2 3 ;10 25 69]
2nd combination=[8 9 10;58 98 75],please help
Walter Roberson
Walter Roberson 2012년 1월 30일
Variable names cannot start with a number. If your requirement is variable names that start with a number, you will need to find a very different computer language.

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

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

태그

질문:

2012년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by