How do I select specific rows in a 1x15 matrix?

조회 수: 3 (최근 30일)
wobbly
wobbly 2021년 10월 18일
편집: Cris LaPierre 2021년 10월 18일
If I havea 1x15 matrix, and I want to call elements 7,8,9 and 14, how would I go about putting it in the second line of code within parenthesis?
Soln = [AB; AI; BI; BC; CH; CI; CD; DE; EH; EG; EF; FG; DH; HI; GH]
Soln(???)
  댓글 수: 1
wobbly
wobbly 2021년 10월 18일
I know to use Soln(7:9) for the first three, but how can I incorporate the 14?

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 10월 18일
See Ch 5 of MATLAB Onramp (indexing into and modifying arrays)
  댓글 수: 2
wobbly
wobbly 2021년 10월 18일
I know to use Soln(7:9) for the first three, but how can I incorporate the 14?
Cris LaPierre
Cris LaPierre 2021년 10월 18일
편집: Cris LaPierre 2021년 10월 18일
That is covered in Ch 5, but enclose all the numbers in square brackets.
A=1:10;
b=A([3:5 8])
b = 1×4
3 4 5 8

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

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by