Filter löschen
Filter löschen

Assign multiple values to array

2 Ansichten (letzte 30 Tage)
RuiQi
RuiQi am 24 Jun. 2016
Beantwortet: KSSV am 24 Jun. 2016
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

Akzeptierte Antwort

KSSV
KSSV am 24 Jun. 2016
test(1:10) = 99 ;
test(end-1:end)=98 ;

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by