How to make a loop that would help me with my code?

1 Ansicht (letzte 30 Tage)
daniel choudhry
daniel choudhry am 25 Sep. 2020
Kommentiert: daniel choudhry am 25 Sep. 2020
I am trying to make c(1),...c(4) is one single process in order to have a c vector. b=[4 1 -3 4] and p=[3 4 2 1]
function c=perm_b(b,p)
n= length(b);
c = zeros(n,1);
for i=1:n
c(1)=b(p(1));
c(2)=b(p(2));
c(3)=b(p(3));
c(4)=b(p(4));
end
end

Akzeptierte Antwort

David Hill
David Hill am 25 Sep. 2020

Weitere Antworten (0)

Kategorien

Mehr zu Partial Differential Equation Toolbox 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