# How to plot graph of financial data with matlab?

Hi,
I am new with Matlab and need some help:
I have financial data that I can produce from another application to a text file.
the  text file structure will be like: (I can change it)

1,1.4524
2,1.4520
3,1.4530
4,1.4520
5,0
6,0
7,0
.
.

The left column (1,2,3,4,..) represents the time in minutes.
The right collumn represents the values that I want to see in the Y axis.

I iuse the File->Import Data to import  the data text file into Matlab.

1) How to write the command for plotting the graph?
2) In case that I want to have a graph of 10 min intervals instead of 1 minute intervals, how to do it from Matlab?

3) When there is no data (e.g. weekend) the right column gets value 0, What is the recommended solution for showing 0 data on the graph(but only as indicator, not spending too much graph space)?
4) How to scale the Y axis to show the correct values? (In this example from 0.9 to 2)
Thanks!
###### Who is Participating?

Commented:
See the code below with comments (after %). In case of missing data you can write NaN (not-a-number) to the data file. Or convert 0s to NaN. There will be a gap on the plot.
``````%% Read the data from comma-delimited file
%% Convert 0s to NaNs
data(data(:,2)==0,2)=NaN;
%% plot 2nd column vs. 1st
plot(data(:,1),data(:,2))
%% plot symbols without lines (see PLOT help for details)
plot(data(:,1),data(:,2),'r*')
%% plot with 10 min interval
plot(data(1:10:end,1),data(1:10:end,2))
%% Scale the Y axis
ylim([0.9 2])
``````
0

Author Commented:
Thanks a lot.
Its working well !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.