14visualizaciones (últimos 30días)
Mostrar comentarios más antiguos
Rodmehr Semnani el 1 de Jul. de 2016
Comentada: Zakia wani el 23 de Nov. de 2016
Respuesta aceptada: Star Strider
Hi everybody.
I've run into a pretty big problem with saving data. I was running some tests with a few sensors and accidentally typed in %d\n instead of %d \n. Now I've lost part of my data and the data I did collect is all in one line (i.e. not separated by the \n).
I do however still have the figure pulled up. It has 3 subplots on it with 3 different data sets. These data sets are not predefined, however. I didn't simply plot them all at once, but rather as they came in from my sensors. I was wondering if there was a way to extract each data point from each subplot individually and store it in a neatly organized fashion.
Thanks!
0 comentarios Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Mostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos
Iniciar sesión para comentar.
Iniciar sesión para responder a esta pregunta.
Respuesta aceptada
Star Strider el 1 de Jul. de 2016
Abrir en MATLAB Online
Yes, there is.
FIRST: save your plot as a .fig file. The easiest way to do this is from the plot figure window itself. Click on the floppy disk icon, then choose to save it as a .fig file, and give it some sort of descriptive name. That saves all the data that created it, so you will still have all your data. You can the extract and write it to a .mat file.
Second, to refer to each subplot as the appropriate subplot.
For example:
sp1data = findobj(subplot(3,1,1), 'Type', 'line')
That should get you started.
Save the figure as a .fig file first, then experiment with getting the data from it.
3 comentarios Mostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Mostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Rodmehr Semnani el 1 de Jul. de 2016
Enlace directo a este comentario
https://la.mathworks.com/matlabcentral/answers/293390-extracting-data-points-from-subplots#comment_376586
⋮
Thanks! I actually tried this method from here and I found a cell of 3 Lines, but it turns out that trying to extract XData or really any data from these lines overloads the memory of the computer. I think I'm just going to have to redo the tests.
For anybody wondering how to do it with data on subplots, you have to save each line from the cell in dataObjs (from the above link) to a separate variable. Mine just happened to be too big for my computer.
Cheers!
Star Strider el 1 de Jul. de 2016
Enlace directo a este comentario
https://la.mathworks.com/matlabcentral/answers/293390-extracting-data-points-from-subplots#comment_376606
My pleasure!
The original in that post refers to getting data from figures in R2014a and previous versions.
Walter Roberson’s Comment refers to getting data from figures in R2014b and later versions. (This is similar to my solution.)
The differences are significant, and what works for R2014a and previous versions (using HG1) will not work in R2014b and later versions (using HG2).
You must have collected a significant amount of data. Your sampling frequency has to be twice the highest frequency component of interest in the signal you’re sampling. More is ‘oversampling’, and while useful isn’t necessary.
Zakia wani el 23 de Nov. de 2016
Enlace directo a este comentario
https://la.mathworks.com/matlabcentral/answers/293390-extracting-data-points-from-subplots#comment_408400
i have the same problem.. my c1.fig file has 11 subplots.. i want to extract data from each subplot as each of them represents a different dataset. i was using f= open (‘c1.fig’); h = findobj (f,’type’,’line’); y1 = get (h(1),’Ydata’); y2 = get (h(2),’Ydata’); y3 = get (h(3),’Ydata’); y4 = get (h(4),’Ydata’); y5 = get (h(5),’Ydata’); y6 = get (h(6),’Ydata’); y7 = get (h(7),’Ydata’); y8 = get (h(8),’Ydata’); y9 = get (h(9),’Ydata’); y10 = get (h(10),’Ydata’); y11 = get (h(11),’Ydata’); then i was plotting.. but matlab is just extracting data from the last subplot and putting it in all subplots… what should i do.. any idea would be grateful
Thanks
Iniciar sesión para comentar.
Más respuestas (0)
Iniciar sesión para responder a esta pregunta.
Ver también
Categorías
MATLABGraphicsFormatting and AnnotationAxes AppearanceCombine Multiple PlotsSubplots
Más información sobre Subplots en Help Center y File Exchange.
Etiquetas
- subplot
- plot
- extract
- data
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia-Pacífico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Comuníquese con su oficina local