Assign multiple values to array

조회 수: 3 (최근 30일)
RuiQi
RuiQi 2016년 6월 24일
답변: KSSV 2016년 6월 24일
I want to assign different values to different parts of my array like below. 1 to 10 gets assigned 99, end-1 to end gets 98. How can i do it ?
test([1:10 end-1:end]) = [99 98];
test([1:10 end-1:end]) works. I am able to print the output

채택된 답변

KSSV
KSSV 2016년 6월 24일
test(1:10) = 99 ;
test(end-1:end)=98 ;

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by