Effacer les filtres
Effacer les filtres

How to extract data from a MATLAB figure containing multiple line plots and save it in a file?

22 vues (au cours des 30 derniers jours)
I am working on the simulations of a BSIM3 type MOSFET model and as a result I need to extract data from a plot which shows the relationship between Ids(drain-source current, in the figure Y-axis; Iprobe1.i) and Vds(drain-source voltage, in the figure X-axis; VD) at increasing levels of gate voltage VG (say at VG=4V,6V,8V...)each represented by a different color. Please ignore the legend beside the plot which shows the value for VG as 0V, 1V etc since they are wrong and misguiding because of maybe improper operation of the TADS interface that I am using for connecting Advanced Design System (my original environment for simulation) and MATLAB.
I have seen examples of data extraction from 2 or 3 line plots maximum but never for multiple line plots and I have no idea how to approach this issue since I even want the VG value to be accounted for. (For eg: at VG=say 4V, I want a list of x and y values and similarly for VG=6V and so on). I have attached the MATLAB figure with this file, kindly help me out and reach out for further details.

Réponses (1)

William Rose
William Rose le 23 Avr 2024
  2 commentaires
William Rose
William Rose le 23 Avr 2024
When I open the file, I get seven error messages. I assume these are due to the imterface that does not work. Please post a figure that can be opened without errors.
The plot has twelve lines with legend 'VG=0;;', twelve lines with legend 'VG=1;;', and twelve lines with legend 'VG=2;;'.. THere are no lines with legend VG=4 or VG=6.
Here are commands to extract data from this figure.
axObjs = fig.Children;
dataObjs = ax1.Children;
To get the x,y data from line 4, do
x4=dataObjs(4).XData; y4=dataObjs(4).YData;
To find out how many x,y pairs are on each line, do this:
for i=1:numLines
If all lines have the same number of pairs, then you can make an array for the x data and an array for the y data. The number of columns in each array equals the number of lines on the plot. The number of rows equals the number of x,y pairs on each line.
Next: Put the x data into array xData, and put the y data into array yData:
for j=1:numLines
Plot the data from line 5:
Shreeja le 23 Avr 2024
Hi, thanks for your answer and help.
Yes the errors you see are because of the TADS interface, because in my original simulating environment on ADS I can see all these lines attributed to VG=4V,6V and so on from the bottom to the top. I have the feeling the interface in itself is pulling the wrong data and hence we see multiple lines for VG=0V, 1V and so on. I tried it again afresh today but it still doesnt work and shows the same plot with these values.

Connectez-vous pour commenter.


En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by