Borrar filtros
Borrar filtros

plot excel data in MATLAB

116 visualizaciones (últimos 30 días)
Samer Husam
Samer Husam el 14 de Jul. de 2012
Comentada: Image Analyst el 15 de Mayo de 2017
hi all, I have two column in excel I want to plot them by using matlab, lets say I have first column from A1-A10 and second column from B1-B10. how could I plot them in MATLAB ?? please help..

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 14 de Jul. de 2012
[v,T,vT]=xlsread('name.xls')
% 'xlsx' for exell 2007
%v: Double
%T and vT : cell
%use v containing numbers
t=v(:,1);y=v(:,2)
%if u have to plot second colone depending on first:
plot(t,y)
  11 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 18 de Jul. de 2012
maby you are ploting num(6:16,1) wich is false,you must use num(:,1)) for the first row and num(:,2) for the second. i don't think you will have an error message
Samer Husam
Samer Husam el 20 de Jul. de 2012
thanks a lot Azzi, walter and image analyst for your help... this is the correct answer, another request how to show the value of the cell if I have time value in my excel file ?? like the excel value is 12.30 ?? how to put in the graph ?

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 14 de Jul. de 2012
Editada: Image Analyst el 14 de Jul. de 2012
Use xlsread() to get the entire contents of your workbook into a cell array.
[num,txt,raw] = xlsread(filename); % From the help
Then use cell2mat or something to extract out columns into an x array and a y array.
x = cell2mat(num(1:10, 1)); % Untested
y = cell2mat(num(1:10, 2)); % Untested
Then, to plot, use
plot(x,y);
  9 comentarios
Walter Roberson
Walter Roberson el 17 de Jul. de 2012
What does size(num) show? And please show your xlsread() command so we are sure we are talking about the same options.
andhavarapu lokesh
andhavarapu lokesh el 6 de Mzo. de 2017
I wanted to plot a excel sheet in matlab is there any method to scale the xaxis and yaxis commonly to all the sheets

Iniciar sesión para comentar.


arif hussain
arif hussain el 14 de Mayo de 2017
Hello; Can someone please help me matlab doesn't plot my excel data it show the axis only.i have attested the excel file as well.
  4 comentarios
dpb
dpb el 15 de Mayo de 2017
Almost certainly a spellcheck miss from a non-English speaker attempting "attached".
Image Analyst
Image Analyst el 15 de Mayo de 2017
I guess that makes sense, instead of "verified". However the file was NOT attached - only a screenshot was displayed, no Excel file was attached. Use the paperclip icon.

Iniciar sesión para comentar.

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by