How to insert value in the first of vector?

조회 수: 1 (최근 30일)
Mira le
Mira le 2019년 12월 29일
답변: Star Strider 2019년 12월 29일
CumProb
ans =
0.1579 0.2105 0.3158 0.4211 0.5263 0.7895 1.0000
I want to insert the value 0 at the begining of the vector CumProb
the result=
0 0.1579 0.2105 0.3158 0.4211 0.5263 0.7895 1.0000

채택된 답변

Star Strider
Star Strider 2019년 12월 29일
Probably the easiest way is to do exactly that:
CumProb = [0.1579 0.2105 0.3158 0.4211 0.5263 0.7895 1.0000];
CumProb = [0 CumProb];
Another option:
newCumProb = zeros(1,size(CumProb,2)+1);
newCumProb(2:end) = CumProb;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by