Filter löschen
Filter löschen

insert 0 in the each 3N location

2 Ansichten (letzte 30 Tage)
Phong Pham
Phong Pham am 18 Jul. 2016
Beantwortet: Laura am 18 Jul. 2016
I have matrix A that has something like this
A = [ 1 2 .5 .6 -.7 .9, so on]
Now I want A to fill with zero at location 3, 6, 9 to 3N.
A= [ 1 2 0 .5 .6 0, -7, .9 0 , etc.]

Akzeptierte Antwort

Laura
Laura am 18 Jul. 2016
B=zeros(1,3*N)
for i=1:N
B(1,3*i-2) = A(1,2*i-1);
B(1,3*i-1) = A(1,2*i);
end

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by