How to pass the array of values in loop?
Afficher commentaires plus anciens
temp = [ 21, 131.38,18.52
22, 141.38,19.8021
1162.56 ,181.72, 37.59] %%first column distance,2nd is fuel, 3rd is time
k =0 ,rowcounter = 0;
a.b.c(rowcounter).speed = uint32(300+50)
a.b.c(rowcounter).distance = single(temp[k++]);
a.b.c(rowcounter).fuel = single(temp[k++]);
a.b.c(rowcounter).time= single(temp[k++]);
%%how to pass this values (temp values with K++ in
a.b.c(rowcounter).distance,
a.b.c(rowcounter).fuel,
a.b.c(rowcounter).time)
1 commentaire
Walter Roberson
le 27 Nov 2017
a.b.c(rowcounter).distance = single(temp[k++]);
is not valid MATLAB. MATLAB does not have the ++ operator. MATLAB does not use [] for indexing.
Réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!