how to show result in array

% 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?

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 21 Nov 2013
Edited: Azzi Abdelmalek on 21 Nov 2013
a=[1 2 3 4]
k=a-1

2 Comments

xxx
xxx on 21 Nov 2013
Edited: Azzi Abdelmalek on 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)]

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Asked:

xxx
on 21 Nov 2013

Edited:

on 21 Nov 2013

Community Treasure Hunt

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

Start Hunting!