image thumbnail

PlotData - display plot raw-data in data-tables

version (11.1 KB) by Yair Altman
Displays raw data of figure plots in separate spreadsheet tables


Updated 25 Jun 2007

No License

plotdata(figureName,sheetName,xdata,ydata, xAxisName,yHeaders,...);
[hDataFig, hSpreadsheet] = plotdata(...);

PLOTDATA(hPlotFig) scans the supplied figure handle for any plot axes; for each plot axes found, a new spreadsheet is created with the plot data values (X & Y, not Z). The data is displayed in the color of the plot's original color. If the plot lines have a tag name or DisplayName property (also used by legend), these are used as data column headers. Note that all data vectors (xdata, ydata) must be the same length (this limitation will be removed in a future version). If the plot or subplot(s) have titles, these are used as sheet names. Data stats may be turned on/off using the checkbox at the bottom.
Data may be sorted, filtered, modified and exported to Excel - explore the many options available in the top toolbar!

If the Excel plug-in is unavailable (e.g., on Linux), then tab-based Java tables are used.

PLOTDATA() is equivalent to PLOTDATA(gcf), scanning the currently active figure.

PLOTDATA(figureName, sheetName,xdata,ydata,xAxisName,yHeaders, ...) enables direct data display. Parameters #2-6 may be repeated: each set (5 parameters each) will create a separate spreadsheet.

hDataFig = PLOTDATA(...) returns a handle to the data (spreadsheet) figure

[hDataFig, hSpreadsheet] = PLOTDATA(...) also returns a handle to the spreadsheet object - either an Excel ActiveX, or a Java tabbed-pane.

>> x=0:.01:10; ydata=[sin(x);cos(x)];
>> hFig=figure; plot([x;x]',ydata');
>> plotdata; % scan the current figure for raw data (2 data lines)
>> plotdata(hFig); % scan the selected figure handle
>> plotdata('title','sheet #1',1:3,magic(3),'Xdata',{'1','2','3'});

Known issues/limitations:
1. Works best with Excel Web Component. This is available on any PC that has Excel installed, or can be downloaded for free from and used (read-only) even if Excel is not installed!
2. If the Excel plug-in is unavailable (e.g., on Linux), tab-based Java tables are used but these provide more limited functionality and have minor resizing issues.
3. Requires all plot lines in an axis to have the same xdata. This limitation will be removed in a future version of PlotData.
4. Works on Matlab 7+. Might work on Matlab 6.5. Fails on Matlab 6.0

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

Cite As

Yair Altman (2022). PlotData - display plot raw-data in data-tables (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!