Azzera filtri
Azzera filtri

How to collect non-integers from for loop in one matrix?

2 visualizzazioni (ultimi 30 giorni)
eg: for k=1:.5:10 y(k)=[k] end
this wont work i need output as y=1 1.5 2 2.5 and so on.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 1 Lug 2015
Modificato: Azzi Abdelmalek il 1 Lug 2015
ii=0;
for k=1:.5:10
ii=ii+1
y(ii)=k
end
or
k=1:.5:10
for ii=1:numel(k)
y(ii)=k(ii)
end

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by