DSPRelated.com
Forums

GUI -- HOW TO Get a dynamic filename based on input filenames - MATLAB GUI

Started by vishwa May 8, 2007
Dear Sir/friends

I have a GUI for image processing. In that I have TWO push buttons for loading two images.
Third push button for CALCULATE (histogram)

Here I should have an option of saving the set of two input images, resulting histogram data as a .MAT file for later retrieval.
The file name should be = cocatenation of the two image file names (since I may use any image pairs)
I used the syntax

resultfilename = strcat(filename1.bmp,filename2.bmp) % filename1filename2
resultfilename = strcat(resultfilename,'.mat' ) ; % resultfilename = filename1filename2.mat
save resultfilename image1 image2 histogram % Expected to store as filename1filename2.mat
% BUT storing as resultfilename.mat

kindly suggest me the idea behind to have a dynamic filename as expected based on the input image pairs.

Viswanath K Reddy
Dear Vishwa,

i got what you are trying to do. but the 2 push buttons you talked
about, are they just for display or getting you the files & put it in an
edit box. i am not sure how did you get the file names from,and
resultfilename = strcat(filename1.bmp,filename2.bmp) % This will not
give you "filename1filename2" but "filename1.bmpfilename2.bmp"
% USE some small Algorithm to remove the extensions

resultfilename = strcat(resultfilename,'.mat' ) ; % This is
OK

save resultfilename image1 image2 histogram

change the above to

save(resultfilename,'image1','image2','histogram') % this will solve your
problem.

This will save the variables in the value of the resultfilename i.e.
filename1filename2.mat
Hope this helps,

- Richard

On 5/8/07, vishwa wrote:
>
> Dear Sir/friends
>
> I have a GUI for image processing. In that I have TWO push buttons for
> loading two images.
> Third push button for CALCULATE (histogram)
>
> Here I should have an option of saving the set of two input images,
> resulting histogram data as a .MAT file for later retrieval.
> The file name should be = cocatenation of the two image file names (since
> I may use any image pairs)
> I used the syntax
>
> resultfilename = strcat(filename1.bmp,filename2.bmp) %
> filename1filename2
> resultfilename = strcat(resultfilename,'.mat' ) ; %
> resultfilename = filename1filename2.mat
> save resultfilename image1 image2 histogram % Expected
> to store as filename1filename2.mat
>
> % BUT storing as resultfilename.mat
>
> kindly suggest me the idea behind to have a dynamic filename as expected
> based on the input image pairs.
> Viswanath K Reddy