Add values to the i-th position of a table/double
Show older comments
Hi everyone,
How can I add a values to a double 'x' inside a for cycle?
I do not mean to replace the i-th value itself but to add one value (xsim1) between i»i+1 and one value (xsim2) between i+1»i+2.
For example:
x=data(:,1).'; %1x203 double
y=data(:,2).'; %1x203 double
for i=1:length(x)-2
...
if angle>100
xsim1=(x(i)/2)+x(i+1)/2;
ysim1=(y(i)/2)+y(i+1)/2;
xsim2=(x(i+1)/2)+x(i+2)/2;
ysim2=(y(i+1)/2)+y(i+2)/2;
angle = ... (not relevant);
if angle>100
num_sharp_edges=num_sharp_edges+1;
else
ADD POINT TO THE DOUBLE IN THE RIGHT POSITIONS
I hope I am specifying what I am trying to do clearly.
Thank you very much in advance.
António
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!