How to plot graph of financial data with matlab?

Posted on 2010-01-08
Last Modified: 2016-03-02
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)


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)
Question by:star90
    LVL 15

    Accepted Solution

    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
    data = csvread('filename.txt');
    %% Convert 0s to NaNs
    %% plot 2nd column vs. 1st
    %% plot symbols without lines (see PLOT help for details)
    %% plot with 10 min interval
    %% Scale the Y axis
    ylim([0.9 2])

    Open in new window


    Author Comment

    Thanks a lot.
    Its working well !

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now