Help: Matlab2010a figure output
Afficher commentaires plus anciens
Hi,
When I try to save the Matlab figure to an tiff file, there had some problem.
1) I used the command: >>print -dwin April05.tiff
The figure was saved but when opened it showed as a txt file and read:
%!PS-Adobe-2.0
%%Creator: MATLAB, The Mathworks, Inc. Version 7.10.0.499 (R2010a). Operating System: Microsoft Windows 7.
%%Title: .\April05.tif
%%CreationDate: 04/05/2011 18:09:51
%%DocumentNeededFonts: Helvetica
%%DocumentProcessColors: Cyan Magenta Yellow Black
%%Pages: (atend)
%%BoundingBox: (atend)
%%EndComments
Can any body help me with thiis issue?
2) Is there a way for me to save the figure to another path instead of the current work directory?
Réponse acceptée
Plus de réponses (3)
Andrew Newell
le 6 Avr 2011
Try
print -dtiff April05.tiff
or
print -dtiffn April05.tiff
To view it, use these commands:
A = imread('April05.tiff');
imshow(A)
To save in some other folder, just replace April05.tiff by the full pathname or a relative pathname, e.g.,
print -dtiff ../April05.tiff
EDIT: you could also try
image(A)
21 commentaires
Wencai Lee
le 6 Avr 2011
Andrew Newell
le 6 Avr 2011
Can you view the image outside of MATLAB?
Andrew Newell
le 6 Avr 2011
It's odd that imread created a character array. What happens if you try it on a tiff image created outside of MATLAB?
Walter Roberson
le 6 Avr 2011
After you do the imread(), what does it say the size and data class of A is ?
Wencai Lee
le 6 Avr 2011
Andrew Newell
le 6 Avr 2011
Wencai, what do you get if you type "which imshow -all"?
Andrew Newell
le 6 Avr 2011
The matrix "April05" is consistent with a truecolor tiff image.
Wencai Lee
le 6 Avr 2011
Wencai Lee
le 6 Avr 2011
Andrew Newell
le 6 Avr 2011
Wencai, that message "Has no license available" indicates that your trouble may have to do with your MATLAB license. If you type "ver", you'll see which toolboxes are available; for imshow you need the Image Acquisition Toolbox. If you think you should have this, you could try typing "rehash toolbox".
Andrew Newell
le 6 Avr 2011
In answer to your other question - it should be saved as a matrix. I don't think your problem is saving the image - but did you try viewing April05.tiff using some other software?
Wencai Lee
le 6 Avr 2011
Wencai Lee
le 6 Avr 2011
Andrew Newell
le 6 Avr 2011
What was the command that created this file?
Andrew Newell
le 7 Avr 2011
As for opening the tiff file - I'm not that familiar with Windows, but if you right click it you'll get a menu of options.
Wencai Lee
le 7 Avr 2011
Andrew Newell
le 7 Avr 2011
The most important thing is, you need to type that "ver" command and see if you have the Image Acquisition Toolbox.
Wencai Lee
le 7 Avr 2011
Andrew Newell
le 7 Avr 2011
O.k., but you do have the Image Processing Toolbox. Try these two commands (exactly as written):
I = imread('pout.tif');
imshow(I)
Wencai Lee
le 7 Avr 2011
Sean de Wolski
le 14 Mar 2012
Copying Wencai's comment with license number censored
Oh, sorry didn't quite understand the comment.Here I got:
-------------------------------------------------------------------------------------
MATLAB Version 7.10.0.499 (R2010a)
MATLAB License Number: ######
Operating System: Microsoft Windows 7 Version 6.1 (Build 7600)
Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------
MATLAB Version 7.10 (R2010a)
Control System Toolbox Version 8.5 (R2010a)
Curve Fitting Toolbox Version 2.2 (R2010a)
Image Processing Toolbox Version 7.0 (R2010a)
Signal Processing Toolbox Version 6.13 (R2010a)
Statistics Toolbox Version 7.3 (R2010a)
Wavelet Toolbox Version 4.5 (R2010a)
Lior Shapira
le 6 Avr 2011
0 votes
Might not be what you're looking for, but the SC utility on the file exchange (http://www.mathworks.com/matlabcentral/fileexchange/16233-sc-powerful-image-rendering) converts figures to images, which you can then save with imwrite in whatever format you desire.
1 commentaire
Wencai Lee
le 6 Avr 2011
bym
le 6 Avr 2011
0 votes
Another one of Oliver's contributions could also help
http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig
1 commentaire
Wencai Lee
le 6 Avr 2011
Catégories
En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!