MATLAB Answers

0

matlab graph using excel data

Asked by sidra Rafique on 19 Nov 2019 at 10:56
Latest activity Commented on by sidra Rafique on 19 Nov 2019 at 14:55
hi,
i have an excel file (say file1.xlsx)numeric data with 2000 rows and 25 colums. and i have 20 such excel sheets in this file with the same number of rows and colums.
i want to create a matlab file which will create graph of sheet1 of this excel file and save it with all the settings(labels, legends, font, etc), so that next time i only select the sheet2 and it will auomatically create graph and so on for the next 20 sheets of the same excel file.
is there any tool in matlab for such plotting or i have to write piece of code.
if coding is the solution then please help me through this.
thank you in advance

  0 Comments

Sign in to comment.

2 Answers

Answer by munue
on 19 Nov 2019 at 12:13
 Accepted Answer

Have a look to this question:
It provides some basic commands you could use to implement a solution for your question - Open an Excel file, choose a sheet, read data from that sheet.
Hope it helps.

  3 Comments

sidra Rafique on 19 Nov 2019 at 13:51
this is working .. actually y main concern is plotting. i want make general .m file to plot graphs of my excel file data. i want to add legend , x,y axis labels, ranges etc programatically instead of using plot property editor tool. because this is time taking and i have to create so many graphs.
munue
on 19 Nov 2019 at 14:05
So, after you open your Excel file, choose a sheet and choose the data you want to plot, it is a matter of using the plot function:
At the bottom of that link, you'll find some suggested functions related to some of the functionalities that you are looking for:
If you go into those links you'll find examples of how to work with them, so you can programmatically create your desired plots.
Hope it helps - again
sidra Rafique on 19 Nov 2019 at 14:55
i am facing a strange problem ... i have open an excel file from activex the way you told me in first responce. my original excel sheet has ranges of
max=15.899
min=3.174 like this, but activex has somehow converted the whole data to the range of this.
min=0.000224209
max=0.999552273
i dont know. why this is happening. please help me in understanding this.

Sign in to comment.


Answer by Steven Lord
on 19 Nov 2019 at 14:31

Import the first set of data and generate the figure as you want it to appear. Once you have set up one figure, generate code that you can use with the second, third, etc. data sets to create a new figure that looks roughly like the first. Depending on how your later data sets differ from your first you may need to adjust the appearance of the later figures to get them to look exactly how you want, but the generated code should start you off with something close to what you want.

  0 Comments

Sign in to comment.