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

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 21 Nov 2013
Modifié(e) : Azzi Abdelmalek le 21 Nov 2013

0 votes

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

2 commentaires

xxx
xxx le 21 Nov 2013
Modifié(e) : Azzi Abdelmalek le 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)]

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by