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일

1 개 추천

test(1:10) = 99 ;
test(end-1:end)=98 ;

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

태그

질문:

2016년 6월 24일

답변:

2016년 6월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by