# Export Matlab Plots into sheet

5 Ansichten (letzte 30 Tage)
Valentino am 25 Mär. 2015
Beantwortet: Valentino am 6 Aug. 2015
Hi guys, I want to make a Sheet(which can be opened without Matlab) where my plots a saved. For example i got 3 plots and want them in one sheet. For sure i don't want to copy the plots or something i want the plots automatically written in my sheet, so that i just have to run my code and have my sheet with the data plots.
Thank you for your help.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Valentino am 6 Aug. 2015
Solved it by using subplot and then print.
See my Code
subplot('Position',pos.pos7)
plot(true_stress,true-strain)
subplot('Position',pos.pos3)
plot(stress,strain)
subplot('Position',pos.pos4)
plot(stress,displacement)
print(hfig,'Datasheet','-dpdf')
Don't forget to define the positions...
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (2)

David Sanchez am 25 Mär. 2015
You can do something like this:
Define options to customize the published output as a structure, options_doc_nocode.
options_doc_nocode.format = 'doc';
options_doc_nocode.showCode = false;
Publish the file, specifying the options structure.
publish('your_script_name_here.m',options_doc_nocode);
Take a look at the publish function and its options:
doc publish
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Image Analyst am 27 Apr. 2015
If you know the size of your data will always be constant, you can make up an Excel file where the plots always refer to certain cell locations, like, say, A1:B:300, C1:D300, and F1:G200. Then have MATLAB write the data into those cell locations. Then the plots will automatically use the data you put in there.
##### 2 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Image Analyst am 27 Apr. 2015
Well it's still possible but you might need to use ActiveX to either create the plots or change the ranges of plots already embedded in the workbook. I don't know the exact ActiveX methods - you'd have to look them up. In the meantime, attached is an ActiveX demo for reading and writing to Excel. It's useful if you have to read and write multiple times to the same or multiple workbooks. It will be very much faster than calling xlsread() and xlswrite() multiple times, which required a launch and shutdown of Excel everytime they're called.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on ActiveX in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by