How do I cut a vector from the end of a vector of a certain length and keep it in an independent vector

조회 수: 58 (최근 30일)
How do I cut a vector from the end of a vector of a certain length and keep it in an independent vector
A=[1 2 3 4 5 6 7 8 9]
result
B=[1 2 3 4 5 6 7]
C=[8 9]

채택된 답변

Chunru
Chunru 2021년 7월 31일
A=[1 2 3 4 5 6 7 8 9]
A = 1×9
1 2 3 4 5 6 7 8 9
cutpoint = 7;
B=A(1:cutpoint)
B = 1×7
1 2 3 4 5 6 7
C=A(cutpoint+1:end)
C = 1×2
8 9
  댓글 수: 7

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by