Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
export matlab figures to excel

Subject: export matlab figures to excel

From: sujata

Date: 30 Sep, 2008 13:15:03

Message: 1 of 6

I am building a Graphical User Interface and using xlswrite I export data to excel spreadsheets. However, I also wish to export graphs that are made in the GUI to excel. Does anyone know if and how this is possible in Matlab?

At the moment I use imwrite to make a .bmp file of the graph and read the .bmp file in excel but I want to avoid doing this and link it directly from Matlab To Excel.

Any help is much appreciated.

regards
Sujata

Subject: export matlab figures to excel

From: ObiONE

Date: 30 Sep, 2008 13:24:31

Message: 2 of 6

E=MC1

That's All i'm gonna say for today :-P

U Figure it out.

Subject: export matlab figures to excel

From: Walter Roberson

Date: 30 Sep, 2008 14:43:04

Message: 3 of 6

sujata wrote:
> I am building a Graphical User Interface and using xlswrite I export data to
> excel spreadsheets. However, I also wish to export graphs that are made in
> the GUI to excel. Does anyone know if and how this is possible in Matlab?

You might plausibly be able to find a way to do this in Matlab under
MS Windows, but the only way to do it under any of the other operating
systems that Matlab is supported on would be to find the details of the
(undocumented, proprietary, trade secret, reverse-engineering terminates
your license) excel file format and write out the data in that binary
file format. Thus if portability is a concern, then you should re-think what
you are trying to do.

Subject: export matlab figures to excel

From: Yair Altman

Date: 1 Oct, 2008 22:01:02

Message: 4 of 6

"sujata " <sujatagp@gmail.com> wrote in message <gbt8on$ek3$1@fred.mathworks.com>...
> I am building a Graphical User Interface and using xlswrite I export data to excel spreadsheets. However, I also wish to export graphs that are made in the GUI to excel. Does anyone know if and how this is possible in Matlab?


My OfficeDoc submission on the FileExchange can do this: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15192

Yair Altman
www.ymasoftware.com

Subject: export matlab figures to excel

From: NZTideMan

Date: 2 Oct, 2008 04:34:18

Message: 5 of 6

On Oct 2, 11:01=A0am, "Yair Altman" <altmany...@gmailDEL.comDEL> wrote:
> "sujata " <sujat...@gmail.com> wrote in message <gbt8on$ek...@fred.mathwo=
rks.com>...
> > I am building a Graphical User Interface and using xlswrite I export da=
ta to excel spreadsheets. However, I also wish to export graphs that are ma=
de in the GUI to excel. Does anyone know if and how this is possible in Mat=
lab?
>
> My OfficeDoc submission on the FileExchange can do this:http://www.mathwo=
rks.com/matlabcentral/fileexchange/loadFile.do?objec...
>
> Yair Altmanwww.ymasoftware.com

I just downloaded officedoc and tried it on a Word file.
Writing an image from gcf worked fine, but this did not:

>> jpgfile=3D'd:\Plots\SeicheVect.jpg';
>> if exist(jpgfile,'file'),disp('Yes'),end
Yes
>> officedoc(fid,'write','mode','append','picture',jpgfile)
??? officedoc: Invalid image filename specified

Why did this fail?
Have I misunderstood something?
If I had access to the code, I could figure it out, but it's hidden in
a .p file.

Subject: export matlab figures to excel

From: Yair Altman

Date: 2 Oct, 2008 21:59:02

Message: 6 of 6

NZTideMan <mulgor@gmail.com> wrote in message
> I just downloaded officedoc and tried it on a Word file.
> Writing an image from gcf worked fine, but this did not:
>
> >> jpgfile=3D'd:\Plots\SeicheVect.jpg';
> >> if exist(jpgfile,'file'),disp('Yes'),end
> Yes
> >> officedoc(fid,'write','mode','append','picture',jpgfile)
> ??? officedoc: Invalid image filename specified
>
> Why did this fail?

Thanks for pointing this out: It failed because of a simple bug: I only used isempty(which(filename)) to test for file existence, instead of also checking exist(): which() fails for absolute path names when the file is not in the current path, while all my tests used same-folder images...

A quick workaround is to either use files on the current folder or temporarily add the image's folder to the path.

I'll post a fixed version to the FileExchange soon (need to fire up an old computer with Matlab 6 to test backward compatibilities etc...).

Yair

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us