How can I process a '.mat' file??
Show older comments
At this program for example... http://www.mathworks.com/matlabcentral/fileexchange/26367-guitar-tuner
If you download the program you will see there is a ButtonIcons.mat file which I think are the icons for the GUI buttons on the guitar tuner. How can I process this file ??
11 Comments
Michael Haderlein
on 28 Aug 2014
mat files are binary files which contain variables of any kind. Just drag+drop the file into the workspace window or enter 'load filename.mat' into the command window and the respective variables will be loaded.
John Bitzios
on 28 Aug 2014
Adam
on 28 Aug 2014
load
to load it into the workspace
save
to save it again. You have to use strings for variable names in saving unless you want to save your whole workspace, but the help explains that.
Michael Haderlein
on 28 Aug 2014
save(filename) will overwrite the data in the existing mat file by default. Use the '-append' tag to add data to an existing mat file without deleting the other data in there. If there's no file with this name, it will just be created (however, '-append' will throw an error then).
John Bitzios
on 28 Aug 2014
Edited: John Bitzios
on 28 Aug 2014
John Bitzios
on 28 Aug 2014
Michael Haderlein
on 28 Aug 2014
Well, that's what I said: Open the mat file via load or by drag-and-drop, then change the value of one of the variables and save the mat file again. E.g.
load('D:\MATLAB\fileexchange\GuitarTuner\ButtonIcons.mat')
PlayDisabled=PlayDisabled(:,:,[3,1,2]);
save('D:\MATLAB\fileexchange\GuitarTuner\ButtonIcons.mat')
GuitarTuner
makes the play button appear blue.
John Bitzios
on 28 Aug 2014
Michael Haderlein
on 28 Aug 2014
Which attribute do you mean? The '-append'? That's described in the help of the function. I guess, the author has either drawn it in some other program (e.g. Paint)and saved it as bitmap. In Matlab it's possible, too, of course, just a bit more work.
John Bitzios
on 28 Aug 2014
Michael Haderlein
on 28 Aug 2014
Not much work for such a small image, just not as handy as in Paint or similar programs (when I woke up in the morning, I didn't expect to call Paint a handy program today). Anyway, you can just read wiki or similar about RGB images. There will be better explanations along with illustrations than I could ever provide. If you want to know what this [3,1,2] was, just define a little vector a=1:5 and play around with it the same way (a([3,1,2]),a([1,3,5]), whatever). You'll quickly see what happens ;-)
Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!