matlab-guide

Matlab GUI axes extract position from datacursor

自闭症网瘾萝莉.ら 提交于 2019-12-13 08:03:27
问题 hope anyone can help me. I try to load and display a image in my GUI. After that i activate datacursormode. Now I want to extract the position from my datacursor object and save the informations into a global variable to work on this data. Here is my code: function varargout = myGui(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @myGui_OpeningFcn, ... 'gui_OutputFcn',

Importing values from one window to another in MATLAB GUI

南笙酒味 提交于 2019-12-13 06:57:52
问题 Suppose that I have a button in a window that when I click on it a new window will appear. I call this window (with the name of My_New_Window ) with this syntax: My_New_Window(); I want to insert some values to this new window from main window. I know that I can use setappdata or getappdata for this purpose but Is there another way to this? For example like this syntax: My_New_Window(Values); Another question. When we use setappdata or getappdata , where MATLAB stores this data? In the RAM or

Overriding Ctrl+Z behavior in matlab zoom mode

ぃ、小莉子 提交于 2019-12-13 02:07:47
问题 I want my own Ctrl + Z handler called while in zoom mode rather than the default handler. I found this article on Undocumented Matlab and tried this: function zoomIn_OnCallback(hObject, eventdata, handles) set(handles.image_handle, 'ButtonDownFcn', []); zoom on; [handles.mode_manager.WindowListenerHandles.Enabled] = deal(false); handles.theGui.WindowKeyPressFcn = []; handles.theGui.KeyPressFcn = @theGui_KeyPressFcn; end The code executes, but doesn't override the Ctrl + Z behavior of zoom

How to pass variable to a function created through the guide

自闭症网瘾萝莉.ら 提交于 2019-12-12 21:33:06
问题 I have developed a GUI in MATLAB GUIDE. What is the best way to make data from an external function or class available to functions created by GUIDE? 回答1: The links supplied by ymihere look very helpful. In addition, some of the options (nested functions and using GUIDATA) discussed at those links are addressed in another post on SO: How to create a GUI inside a function in MATLAB? There are a couple of examples there of how the code looks for each case. I am personally partial to using

Finding means of the absolute values of second differences between elements

泪湿孤枕 提交于 2019-12-12 11:24:55
问题 I have a row vector like so: [1 5 6 -4 3] . I want to find means of absolute values of second difference between elements. The second differences in this example are (6-1)=5 ,-4-5=-9 & 3-6=-3 , and the average absolute mean is (5+9+3)/3=17/3 . Is there some way of using MATLAB's efficient matrix/array manipulation to do this nicely? 回答1: For the second difference you can do the following (v is your vector): v(3:end)-v(1:end-2) and from there to calculating the mean of the abs olute value, its

Drawing with mouse on the GUI in matlab

こ雲淡風輕ζ 提交于 2019-12-12 08:04:51
问题 I want to have a program in matlab with GUI, at run the program, user can draw anythings with mouse on the axes in GUI, and i want to saving created image in a matrix. how can i to do this? 回答1: Finally i find a good code and i have changed some parts for customizing for me. with this way, user can drawing anythings in the axes with mouse : function userDraw(handles) %F=figure; %setptr(F,'eraser'); %a custom cursor just for fun A=handles.axesUserDraw; % axesUserDraw is tag of my axes set(A,

What is the best way to display a large text file in MATLAB GUIDE?

孤人 提交于 2019-12-12 07:16:25
问题 How can a MATLAB GUIDE control be used to display the contents of a text file in a GUI? The text file may be very long or very wide so it should have the ability to have vertical and horizontal scroll bars. 回答1: A multi-line editbox may be the best choice to display the text. Example: %# read text file lines as cell array of strings fid = fopen( fullfile(matlabroot,'license.txt') ); str = textscan(fid, '%s', 'Delimiter','\n'); str = str{1}; fclose(fid); %# GUI with multi-line editbox hFig =

How to get handle to active object MATLAB GUI

不羁岁月 提交于 2019-12-12 05:36:46
问题 Im trying to create a calendar using MATLAB GUI. I have two Edit Text objects - edittext1 and edittext2 . I want to do this one: I put cursor at edittext1 then select date at calendar and it pits into text field of edittext1 . And the same for edittext2 : if I put cursor into edittext2 and select date it puts into edittext2 Edit Text. I know I can use callback for calendar this way. Question: How can I put into Callback function handler to ACTIVE edit text object? How to get handle to object

Change mouse courser when mouse is passing the static text in MATLAB

 ̄綄美尐妖づ 提交于 2019-12-12 04:57:27
问题 I want mouse cursor changing when mouse is on a static text (not clicking on it,only changing on the area of static text). I found these java cods in undocumented-matlab : jb = javax.swing.JButton; jb.setCursor(java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); I copied these codes in CreareFcn and ButtonDownFcn of static text but nothing changed and everything was as default. How can I do this and where should I put these codes in static text ? Thanks. 回答1: You can achieve this using a mouse

using timer in MATLAB to extract the system time

ぃ、小莉子 提交于 2019-12-12 04:54:28
问题 !I am using MATLAB to design an Analog Clock. Currently, my code simply displays the (or plots rather) the clock design with the hands (hours, mins, secs) and does not tick. Here is my code: function raviClock(h,m,s) drawClockFace; %TIMER begins------- t = timer; t.ExecutionMode = 'FixedSpacing'; %Use one of the repeating modes t.Period = 1; %Fire on 1 second intervals t.TimerFcn = @timer_setup; %When fired, call this function start(t); set(gcf,'DeleteFcn',@(~,~)stop(t)); end function timer