File Exchange

image thumbnail

PlotData - display plot raw-data in data-tables

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

3 Downloads

Updated 25 Jun 2007

No License

Syntax:
plotdata;
plotdata(hPlotFig);
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.

Examples:
>> 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 microsoft.com 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 (2020). PlotData - display plot raw-data in data-tables (https://www.mathworks.com/matlabcentral/fileexchange/15372-plotdata-display-plot-raw-data-in-data-tables), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Peng Liu

I was running the example provided by this function in matlab 2017b and got error at line 695 "tablePeer.setUIContainer(hContainer);"
No method 'setUIContainer' with matching signature found for class 'com.mathworks.hg.peer.UitablePeer'.
Is this because of matlab version?

Thanks!

Sherif

Excellent work.

Dalle Ali

hey it looks and works great! thanks!

Raz Shimoni

Junwoo Lee

This is exactly same thing that I was concern. Excellent job!!!.

Updates

1.0.0.0

Added hSpreadsheet return arg; used Java tables if Excel is unavailable

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