How to load .mat file in matlab GUI and display as pcolor data plot in axes in the GUI

5 次查看(过去 30 天)
Hi I'm the beginner in using MATLAB GUI and need some help. I have the several files of array matrix of 128 rows and 128 column for each file that I saved as *.mat file. Then, I plan to use the pop-up menu in GUI. So that, when I select the one of the list in the pop-up menu, it will appears the array matrix file accordingly as the pcolor data plot type on the axes of the GUI.
Thus, anybody can give an idea how to load that *.mat file and appears it as pcolor data plot type?
I know that I have to load the .mat file first?what is the suitable code to load the file in the callback function? Then, how to write the code to appears it as pcolor data type?

采纳的回答

Walter Roberson
Walter Roberson 2016-1-15
datastruct = load('YourFileNameHere.mat');
data = datastruct.NameOfVariable;
pcolor( data, 'Parent', handles.AxesToDisplayIn );
When you store data in a .mat file, you have to store it as a particular variable name -- typically the same as the name of the variable that data was in at the time it was save()'d. In the above code, change NameOfVariable to the name of that variable. Change AxesToDisplayIn to the Tag associated with the axes you created to display the pcolor plot.

更多回答(1 个)

yasmin
yasmin 2016-1-15
thank you,
it worked successfully!

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by