Hello,
I already asked this question before but it is really important to have an answer since the last answer i got wasn't helpful.
i will post the whole code:
"hold on
load(Filename.mat')
low=20;
high=30;
for i=1:235
f=find(vr(:,1)==i); vr indexes are from 1 to 235 but vr is 11000 rows and 0 columns
indexfmax=f(1,1);
indexfmin=f(end,end);
lamda=(vr(f,3)./vr(f,2));% range between 20 and 30
index1=find(lamda>=low & lamda<=high);
maxindex=max(index1);
minindex=min(index1);
x(1,i)=sqrt((vr(f(1,1),8)-vr(f(1,1),6))^2 + (vr(f(1,1),9)-vr(f(1,1),7))^2);%x here is the length for each path
reference(1,i)=sqrt((vr(f(1,1),6))^2 + (vr(f(1,1),7)^2));
if isempty(index1)
averageV(1,i)=NaN;
else
averageV(1,i)=mean(vr(minindex:maxindex,3));
end
end
path1=find(x>=59 & x<=61); path2=find(x>=79 & x<=81);
% For low=20
if low==20
for j=1:47 %path1
if low==20
if rem(j,2)==0
y(1,j:47)=20;
else
y(1,j:47)=21;
end
p1(:,j)=[reference(1,path1(1,j)) y(1,j)];
p2(:,j)=[reference(1,path1(1,j))+x(1,path1(1,j)) y(1,j)];
end
end
averageV=round(averageV);
normalized=averageV/max(averageV);
for j=1:47
if (~isnan(normalized(1,path1(1,j))))
% plot([ p1(1,j) p2(1,j)], [p1(2,j) p2(2,j)])
plot3([ p1(1,j) p2(1,j)], [p1(2,j) p2(2,j)],[normalized(1,path1(1,j)),normalized(1,path1(1,j))],'Linewidth',1);
else
continue;
end
end
colorbar
xlim([0 2000]);
ylim([0 100])"
how can i specify the color of the line plotted by joining the 2 points p1 and p2 according to its corresponding velocity from matrix 'normalized' OR 'averageV'
the averageV could contain velocity as NaN or between 400 and 1200 and after knowing the min and max, the color should be distributed between them (yellow to blue for example) and each velocity corresponds to a color. is that possible ? because it's been 3 months and it didnt work so maybe it's not possible to do that in matlab?