필터 지우기
필터 지우기

Simple vector question.

조회 수: 1 (최근 30일)
Sebastian Daneli
Sebastian Daneli 2022년 4월 4일
댓글: Sebastian Daneli 2022년 4월 4일
Say that I have the vectors
v1=[1 2 3]
v2=[4 3 8]
how can I, by using these two, create the following vector
v3=[4 3 3 8 8 8]
i.e., a vector with one 4s, two 3s and three 8s.

채택된 답변

David Hill
David Hill 2022년 4월 4일
v=repelem(v2,v1);
  댓글 수: 3
David Hill
David Hill 2022년 4월 4일
sum(~isnan(X),2)
Sebastian Daneli
Sebastian Daneli 2022년 4월 4일
Great, thanks.

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

추가 답변 (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