필터 지우기
필터 지우기

How to use cell indexes into a matrix?

조회 수: 2 (최근 30일)
Ibrahs
Ibrahs 2022년 8월 17일
댓글: Ibrahs 2022년 8월 18일
Hi everyone
I have indices as cells such as A{:,:}= {A1=1x212 double, A2= 1x218 double, A3= 1x216 double, A4=1x218 double};
and a Matrix B (j,t) where rows j=j1, j2, j3, j4 and columns t has to vary in function of rows of each elements of A;
I would like to have a cell array C that is a result from the combination of each row of B and each element of indexes A such as
C={B(j1,A1); B(j2,A2); B(j3,A3); B(j4,A4)}
Would anyone help me to fix that issue? Thank you.
Best

채택된 답변

Jan
Jan 2022년 8월 18일
편집: Jan 2022년 8월 18일
Would this trivial method solve your needs?
C = {B(j(1), A{1}); B(j(2), A{2}); B(j(3), A{3}); B(j(4), A{4})}
  댓글 수: 1
Ibrahs
Ibrahs 2022년 8월 18일
thank you, this works. I also found a solution using a loop.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by