Borrar filtros
Borrar filtros

Matlab won't plot a graph of my data?

58 visualizaciones (últimos 30 días)
Nicola Fairbairn
Nicola Fairbairn el 17 de Feb. de 2018
Comentada: Image Analyst el 11 de Ag. de 2023
I'm currently plotting a simple data table of excel data (a 12445 by 8 table where the first column is the x axis and the rest of the columns are multiple plots on the same graph (using the hold on function) Now I've had this issue before but this time I just can't seem to shake it - not sure if it's a glitch. I broke the code down from the more efficient script I wrote to see whether I could place breakpoints and see where the issue lay. So far I have:
x = KAcConcentrationsat130K.WaveNumber(2:12445);
y2 = KAcConcentrationsat130K.VarName2(2:12445);
figure
plot(x,y2)
title('KCH_3COO Varying Concentrations at 130K')
xlabel('Frequency (cm^-^1)')
ylabel('Absorbance')
hold on
y3 = KAcConcentrationsat130K.VarName3(2:12445);
plot(x,y3)
However, MATLAB does not plot the graph. No figure windows come up and instead it just prints every integer value of data (atleast 12000 values) out in the command window. Has anyone got an idea of how to stop it from printing the data out in the command window and plot it instead?
  3 comentarios
Nicola Fairbairn
Nicola Fairbairn el 17 de Feb. de 2018
I'm not sure what you mean?
Rik
Rik el 17 de Feb. de 2018
I suspect that something overwrote the internal plot function, so by running the line of code below, you can find out if this is the case.
which plot

Iniciar sesión para comentar.

Respuestas (3)

Image Analyst
Image Analyst el 17 de Feb. de 2018
In the command window, do this:
>> which -all plot
Tell us what you see. You might see this:
>> which -all plot
built-in (C:\Program Files\MATLAB\R2017b\toolbox\matlab\graph2d\plot)
C:\Program Files\MATLAB\R2017b\toolbox\matlab\polyfun\@polyshape\plot.m % polyshape method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\polyfun\@alphaShape\plot.m % alphaShape method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\bigdata\@tall\plot.m % tall method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\graphfun\@graph\plot.m % graph method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\graphfun\@digraph\plot.m % digraph method
C:\Program Files\MATLAB\R2017b\toolbox\signal\signal\@dspdata\plot.m % dspdata method
C:\Program Files\MATLAB\R2017b\toolbox\stats\classreg\@LinearModel\plot.m % LinearModel method
C:\Program Files\MATLAB\R2017b\toolbox\matlab\timeseries\@timeseries\plot.m % timeseries method
If you see anything that says plot is a variable, that's a problem because it means that you made a variable with the same name as a crucial built-in function and it's using that variable instead of the built-in function. And since you didn't put the semicolon at the end of the line, it's printing all the values to the command window.
Or you could put that line of code directly into your script, before you call plot(), and see what it prints out. From the sounds of it, chances are high that you defined a variable called plot. Search for everywhere in your code that you used plot by typing control-shift-f.
  5 comentarios
Nicola Fairbairn
Nicola Fairbairn el 19 de Feb. de 2018
Editada: Nicola Fairbairn el 19 de Feb. de 2018
So I've changed the column variables and nothing has fixed. It seemed to run fine on a different computer in the lab, not sure whether its a glitch. There is nothing in the Workspace with a generic name. Thoughts?
Walter Roberson
Walter Roberson el 19 de Feb. de 2018
When you say the issue has come back, do you mean your code is displaying a bunch of data as indicated in your original post?
In order for the current code to be displaying a bunch of data, NaTFAcooling.WaveNumber would have to be a function that displayed data, or else title or xlabel or ylabel would have to be something different than their normal function. It would not be enough for plot to have become a variable as you have the semi-colon at the end of the line that would block output; the same for set

Iniciar sesión para comentar.


Nicola Fairbairn
Nicola Fairbairn el 18 de Feb. de 2018
I took out some unnecessary data that I didn't need (I only really cared about 4000 rows of the 12000) and it seemed to work yesterday, I will run it tomorrow and let you know what happens.

Eddie Murray
Eddie Murray el 11 de Ag. de 2023
Why Do I Get This When I Try To Run A Graph In MATLAB
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceCamera
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during reparentChildren
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Could not find node in peer tree during replaceChild
Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild
Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild
  1 comentario
Image Analyst
Image Analyst el 11 de Ag. de 2023
Probably an error in the program you wrote.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

Iniciar sesión para comentar.

Categorías

Más información sobre Bar Plots 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