f



print jgp to file, set resolution, and have file name a variable

Ok I have what appears to be an easy problem.

I need to capture a figure and save it as a jpg. This is very easy
with:

print -r0 -djpeg jpg_file_name

BUT>>>>

How can i use a variable for the file's name?

Right now I can save this as "jpg_file_name.jpg" then make a scrpit
that changes the file's path and name. There has to be an easier
way. Why can't I just save the resolution, size, format, path and
filename in one or two lines of code?
0
dhenner (40)
1/5/2007 1:36:20 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
455 Views

Similar Articles

[PageSpeed] 52

"David Henner" <dhenner@psemi.com> wrote in message 
news:ef4a41b.-1@webcrossing.raydaftYaTP...
> Ok I have what appears to be an easy problem.
>
> I need to capture a figure and save it as a jpg. This is very easy
> with:
>
> print -r0 -djpeg jpg_file_name
>
> BUT>>>>
>
> How can i use a variable for the file's name?
>
> Right now I can save this as "jpg_file_name.jpg" then make a scrpit
> that changes the file's path and name. There has to be an easier
> way. Why can't I just save the resolution, size, format, path and
> filename in one or two lines of code?

Use the functional form of PRINT rather than the command form.


filenameVariable = 'myfile.jpg';
print('-r0','-djpeg', filenameVariable)


-- 
Steve Lord
slord@mathworks.com 


0
slord (13689)
1/5/2007 4:28:22 AM
Reply: