MATLAB: How can you apply single value to range in XY plot

#value rangeMATLABplot

Hi,
I'm quite new to Matlab and I'm struggling with one particular problem. Can you apply single value of Y to a range of values of X without having to make a new matrix when plotting? For example, you have an engine with rpm from 1000 to 8000. You divide rpm range to 250 rpm subranges, so you have matrix like:
rpm=[1000,1250;1250,1500;1500,1750;so on].
And every 250 rpm range has a specific value which applies to that range, for example
value=[60;70;75;so on].
I would like to plot as in:
hold on for i=1:length
plot(rpm(i,:), value(i)).
end
I can't seem to make such a plot, do you have any recommendations or does Matlab has some plot function for this? Because of some specifics I can't make a new matrix with sorted values and it would take a lot of time to sort everything because of large number of data sets. Presented case is just for visualisation of what I need.
Thank your for your time!

Best Answer

rpm = 1:100 ;
val = 1:10 ;
rpm = reshape(rpm,10,[])' ;
figure
hold on
for i = 1:length(val)
X = rpm(i,:) ;
Y = repmat(val(1),1,size(rpm,2)) ;
plot(X,Y,'color',rand(1,3))
end
Related Question