Thread Subject: Missing values

Subject: Missing values

From: sr

Date: 8 Feb, 2012 04:47:10

Message: 1 of 2

Hi Friends,

Here is an example of a simple plot code with missing values between 2 and 8 on x-axis and corresponding y-values.
x=[1 2 8 9];
y=[2 3 4 5];
plot(x,y);
set(gca,'xtick',x);

when i plot it interpolates between 2 and 8 on the x-axis. Is there a way to delete the gap between 2 and 8? i.e. irregular xlabel and x-ticks? In other words, i just want to plot 1,2,8,9 data points on x-axis instead of 1,2,3,4,5,6,7,8,9.

I deal with large data sets and i have several such gaps in my data set. I don't need to plot the missing values. But i dont want monotonically increasing x-axis either. Please help me if you have any idea.

Cheers

Subject: Missing values

From: per isakson

Date: 8 Feb, 2012 06:08:18

Message: 2 of 2

"sr" wrote in message <jgsuod$8hn$1@newscl01ah.mathworks.com>...
> Hi Friends,
>
> Here is an example of a simple plot code with missing values between 2 and 8 on x-axis and corresponding y-values.
> x=[1 2 8 9];
> y=[2 3 4 5];
> plot(x,y);
> set(gca,'xtick',x);
>
> when i plot it interpolates between 2 and 8 on the x-axis. Is there a way to delete the gap between 2 and 8? i.e. irregular xlabel and x-ticks? In other words, i just want to plot 1,2,8,9 data points on x-axis instead of 1,2,3,4,5,6,7,8,9.
>
> I deal with large data sets and i have several such gaps in my data set. I don't need to plot the missing values. But i dont want monotonically increasing x-axis either. Please help me if you have any idea.
>
> Cheers

x=[1 2 nan 8 9];
y=[2 3 nan 4 5];
plot(x,y)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
plot with missi... sr 7 Feb, 2012 23:49:21
rssFeed for this Thread

Contact us at files@mathworks.com