How to pass the array of values in loop?

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 Comment

a.b.c(rowcounter).distance = single(temp[k++]);
is not valid MATLAB. MATLAB does not have the ++ operator. MATLAB does not use [] for indexing.

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Asked:

on 27 Nov 2017

Commented:

on 27 Nov 2017

Community Treasure Hunt

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

Start Hunting!