Plotting file data, MATLAB in Engineering

Plotting File data:

It is frequently essential to read data from a file and plot it. Generally, this entails knowing the format of the file. For illustration, let us suppose that a company has two divisions, called A &B. The file 'ab06.dat' has 4 lines in it (we will suppose this), with the sales figures in millions for the two divisions for each quarter of the year 2006. For illustration, the file may appear like this (the format will be precisely like this):

A5.2B6.4

A3.2B5.5

A4.4B4.3

A4.5B2.2

 

The script below reads the data and plots in one Figure Window the data as the bar charts. The script prints an error message when the file open is not successful or when the file close was unsuccessful. The axis command is used to force the x-axis to range from 0 to 3 and the y-axis from 0 to 8 that will result in the axes shown here. The numbers 1 and 2 would display on the x-axis instead of the division labels A and B by default. The set function modifies the XTickLabel property to use the strings in the cell array as labels on the tick marks on the

x-axis; and gca returns the handle to the axes in the present figure (it stands for "get present axes").

609_Plotting File data.png

Running this generates the subplot as shown in figure.

1154_Plotting File data1.png

Posted Date: 10/22/2012 2:23:20 AM | Location : United States







Related Discussions:- Plotting file data, Assignment Help, Ask Question on Plotting file data, Get Answer, Expert's Help, Plotting file data Discussions

Write discussion on Plotting file data
Your posts are moderated
Related Questions
Tracing of Square matrices: The trace of a square matrix is the addition of all the elements on the diagonal. For illustration, for the preceding matrix it is 1 + 6 + 11 + 16,

Illustration sorting vectors of structures: This function sorts the structures depend only on the price field. A more common function is shown next, that receives a string whi

Finding products by for loop: an illustration, when 5 is passed to be the value of the input argument n, the function will compute and return 1 + 2 + 3 + 4 + 5, or 15: >> s

1. Write a MATLAB function (upperTriangle) using the functions you previously created to convert a matrix to upper triangular form. Start with row 1, column1. Find the row that has

Help command: The help command is used with the script rectarea, the function readlenwid, and the major function printrectarea. To see the first comment in the subfunction, as

Splits a string : The strtok function splits a string into pieces; it can be called in many ways. The function receives one string as an input argument. It appears for the fir

Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Creating the structure Variables: Creating a structure variable can be accomplished by simply storing the values in fields by using assignment statements, or by using the stru

Calling of Function polyval: The curve does not appear very smooth on this plot, but that is as there are only five points in the x vector. To estimate the temperature

calcrectarea subfunction: function call: area = calcrectarea(len,wid); function header: function area = calcrectarea(len, wid)   In the function call, the two arg