% a=[1 2 3 4];
a=[ 4 8 98 12 ];
s=0;
for i=1:3
s=s+s(i);
end
k=[s]
i want my result be like this %k=[0 1 2 3]
k=[0 4 8 98]
how to do it?

 Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 21 Nov. 2013
Bearbeitet: Azzi Abdelmalek am 21 Nov. 2013

0 Stimmen

a=[1 2 3 4]
k=a-1

2 Kommentare

xxx
xxx am 21 Nov. 2013
Bearbeitet: Azzi Abdelmalek am 21 Nov. 2013
but a=[ 4 8 98 12 ] and i want that k=[0 4 8 98] that solution can not be answer for this one ((
a=[ 4 8 98 12 ]
k=[0 a(1:end-1)]

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by