von pospiech | Mrz 1, 2013 | matlab
The following code is an example for a loop function with a waitbar that allows canceling of the loop with the cancel button: Note however that a waitbar consumes very much time. Depending on the code this can slow down the calculation significantly. if numel(indices)...
von pospiech | Mrz 1, 2013 | matlab
In matlab one has to place radiobuttons in a uibuttongroup to make them exclusively selectable. In the startup of the gui one can select the default selection and define a callback function set(handles.uibuttongroupView, ‘SelectedObject’,...
von pospiech | Mrz 1, 2013 | matlab
Matlab provides the function of making axes zoomable in a gui (zoom reference). In a matlab gui this is enable by using this code: hZoom = zoom; setAllowAxesZoom(hZoom,handles.axes,true);...
von pospiech | Feb 13, 2013 | matlab
Very often I tend to save the results of a file under the same name, but with a modified extension. This code shows how to achieve this % change extension [~, ~, ext] = fileparts(FileName); FileName = strrep(FileName, ext, ‘-xyz.png’); If the file should...
von pospiech | Feb 5, 2013 | matlab
The callback of an ui element is called whenever the element has been modified. However this does not necessarily mean that the value of the element has changed. Here is an example where an action is only performed if the value has changed. The trick is to use a value...
von pospiech | Jan 25, 2013 | matlab
The popupmenu of the matlab gui is based on the uicontrol class. Below is a sample code for its usage: % create text entries in menu colormapStr{1}= ‘blue-red’; colormapStr{2}= ‘red-blue’; colormapStr{3}= ‘gray’;...