I just found out that it could be much more simpler: I just declare dbs as a handle class. Then in GUI's OpeningFcn, assign a field to dbs: handles.myvar = varargin{1};. Since dbs now is a handle class, everything i do with dbs outside the GUI (i.e in Command Window)...

As I wrote in the comments, check the Units and Position properties of your main figure window. If built in GUIDE, you can do this in the GUIDE interface by double clicking anywhere on the figure window (not one of the subcomponents) to open the property manager. You can also...

nlp,matlab,matlab-guide,matlab-compiler

Heres a detailed description of using matlab with the stanford max entropy pos-tagger: http://utkarshu.in/Easy_POS_tagging.html It doesn't use wordnet but will work for pos-tagging. Hope this helps! edit... You don't need to know java to make this work, but you should have java installed (if you don't already see https://www.java.com/en/download/help/download_options.xml and...

You could use the createMask method of the imroi class to create a logical mask with the ellipse just drawn, and then sum all the pixels whose value is 1 (or 0...) in order to get the area. You can add something like this in your draw_circle_Callback: Simple example which...

You can use the built-in findpeaks, for example: [pks,locs] = findpeaks(data) returns local maxima or peaks, pks, in the input data, with the indices of the local peaks locs. The input data requires a row or column vector with real-valued elements with a minimum length of three. findpeaks compares each...

matlab,user-interface,matlab-guide,axes,imshow

You GUI organization seems a bit chaotic. You have to be careful where you place the extra code in the .m file generated by the GUIDE. I suggest you replace all the code you placed in the middle of the function by a call to your own initialization function: myGuiInitialization(handles)...

matlab,matlab-guide,matlab-deployment,matlab-compiler

Matlab docs are here From there : zscore(X,flag,dim) If flag is 0 (default), then zscore scales X using the sample standard deviation... If flag is 1, then zscore scales X using the population standard deviation zscore(X,flag,dim) standardizes X along dimension dim You wouldn't change the 2 to a 4 unless...

matlab,image-processing,matlab-guide

Your error likely occurs because this command: axes(handles.axes1) refers to an element of GUI 1 whereas the line is executed in GUI 2 and the latter does not recognize the variables coming from GUI 1 because they have their own workspace. You could work around this problem using setappdata/getappdata or...

I'm posting this as an answer because a comment would be too long and ugly. From the comments it looks like the GUI does not recognize the text box since it is not in its handles structure, therefore when a callback is executed the GUI does not know where to...

matlab,matlab-guide,togglebutton

In your present implementation of the counter, the while loop in the startStop_togglebutton callback is activated the first time you press the pushbuttonn to Start counting. It keeps running until the condition (counter < 10) holds even if you press again the ushbutton to Stop the counting. Therefore, to fix...

matlab,matlab-guide,matlab-deployment,matlab-compiler

If you want your final results returned from the function, define them as output in the function header: function Synonyms = takesynonyms(words) This way you can call the function and retrieve its output into some variable: goodSynonyms = takesynonyms('good'); Read more about defining functions in the documentation....

matlab,neural-network,workspace,matlab-guide

From the wording of your problem it sounds like finalnet is a previously stored workspace such that finalnet.mat is located in some directory. Let's assume the current directory. In this case you need to load the workspace into your GUI. Assuming that's in some random callback function, you want to...

matlab,user-interface,properties,matlab-guide

Here's a small example: h = uicontrol('style', 'edit', 'string', 'initial string'); %// create object set(h, 'string', 'changed string'); %// change object property (The second line could be part of the another object's callback function, which causes the first object's string to change.) As an alternative, if you don't have a...

The issue is with how GUIDE is setting the Parent property of your second UIpanel. As you're dragging panel 2 onto panel 1, if panel 1 is highlighted it will be set as the parent of panel 2. The visibility of the children in a panel is controlled by their...

Each function has its own workspace, and callbacks generated by GUIDE share data associated with what is called the handles structure. Every components of the GUI (axes, pushbuttons, etc.) are associated with the figure in which they are located. Hence GUIDE already provides the callback functions with everything stored in...

matlab,uitableview,matlab-guide,cell-array,clickable

Short answer: you can't MATLAB GUI only provides only a very parse set of possible gui-elements check this documentation of MATLAB GUI. You need to change your request, so e.g. create an uitable or something like this. If you desire to create more advanced stuff in MATLAB GUI's, then you...

This is because of the way Matlab organise the indexing of its arrays. If I simplify your example, you type: aaaa bbbb cccc in your text box. When you retrieve this string with get, look at the type of the variable which is returned. It is not a simple string,...

matlab,matlab-figure,matlab-guide

I'm considering nodes in this answer. For edges it would be similar. You need to handle the node distinction within the callback function. This function is common to all nodes, but can know which node has been clicked because the node is passed as an input. Within this function you...

matlab,statistics,matlab-guide,matlab-deployment

That scaling comes from linear algebra. That's what we call normalizing by producing a unit vector. Assuming that each row is an observation and each column is a feature, what's happening here is that we are going through every observation that you collected and normalizing each feature value over all...

matlab,user-interface,matlab-figure,matlab-guide

I finally figured it out. ORZ It is because i tried to use the GUI by directly operating in the .fig file. If so the data cannot transmit. And the correct way is to push the run button in the .m file! Hope nobody will do the same stupid thing...

If you want to create a function that behaves like isosurface() you can take a look at how it's done in it. You can do so by entering edit isosurface in the Matlab console. The part regarding the light when there is no axes is this one: if isempty(ax) view(3);...

matlab,matlab-figure,matlab-guide

There is no documented function in MATLAB allowing you to do so. However, there are many undocumented features that rely on java which you can use to your advantage, such as controlling your computer's volume. Fortunately, there is a wonderful website about undocumented Matlab stuff right here in which Yair...

matlab,matlab-guide,matlab-compiler

Trial versions of MATLAB Compiler produce executables that expire at the same time as the trial. To produce a permanent executable you will need to pay for a full license.

matlab,user-interface,histogram,matlab-guide

You can set figure's ButtonDownFcn property to a function that will get the CurrentPoint with X coordinates. set(gcf,'ButtonDownFcn',@your_bd_function) (You can use any figure handle instead of gcf, of course.) Then in the function curpnt = get(gca,'CurrentPoint'); % returns [x y] vector where you clicked (Again use appropriate axis handle here.)...

sql,matlab,textbox,matlab-guide

If results is a cell array then simply do: set(handles.edit1,'String',results{1}); and repeat for each string. Or, if you wish, you can use arrayfun: arrayfun(@(k) eval(['set(handles.edit' num2str(k) ',''String'',results{' num2str(k) '}); ']),1:5); ...

matlab,matlab-figure,matlab-guide

The solution is using normalized units: set(gca,'Units','normalized','Position',[0.1 0.1 0.8 0.8]) ...

If you really want something like a stop button, the only choice is to implement a check in your long-running process that frequently asks whether it should stop or not. A tiny counter example: function teststop f = figure('pos', [0,0,200,100],... 'menubar', 'none',... 'toolbar', 'none'); movegui(f, 'center'); c = uiflowcontainer(f, 'FlowDirection',...

Here is a way to work around the problem. Basically I put the 'All' option at the end of the strings in the popup menu, and if the user selects it, then val is equal to 6, i.e. the number of elements in handles.Data+1, which makes the condition for entering...

matlab,user-interface,matlab-guide

Use the get function if(strcmp(get(obj, 'String'), 'Text') If you don't know you object, you can use findall(0, 'Tag', 'yourtag') ...

matlab,events,user-interface,matlab-guide,handles

You can use anonymus functions as callbacks which will provide the handles. For example: function varargout = myGUI_OutputFcn(hObject, eventdata, handles) varargout{1} = handles.output; dataEnv = getappdata(hObject.Parent, 'ratData'); addlistener(dataEnv,'TrialChanged',@(e,d) respond_TrialChanged(e,d,handles.output)); end function respond_TrialChanged(dataEnv, eventData, handles) do_something(handles) % I want to access the GUI handles here end The tird argument to the...

matlab,matlab-figure,matlab-guide

I will post a solution to my own question. Apparently the Callback of a listener is not declared as a "GUI Callback" which is why the GUI can not be accessed from within boxHeightChange if the GUI option "command-line accessibility" is not set to "On". That means: In GUIDE go...

matlab,user-interface,matlab-guide

Here is a trick that should work: Somewhere in the GUI, like in its OpeningFcn for instance, initialize a flag named for example StopNow to false and store it in the handles structure of the GUI. Then in the loop that takes long to execute, put an if statement with...

matlab,user-interface,matlab-guide

Welcome to SO. There is a syntax error in your code. Instead of: set(handles.result('Data',Final)) you should write: set(handles.result,'Data',Final) Hope this helps !...

matlab,svg,matlab-figure,matlab-guide

If you look at the documentation for print, the -dsvg flag is for Simulink models only, not MATLAB figures: For plot2svg, I would report this to the author via the File Exchange....

You can use the addNewPositionCallback method to add your own callback function to be executed whenever the rectangle changes its position. First, you need to create a function to be called with the new rectangle position: function myFunc( newRect ) fprintf(1, 'New rect position = [%d %d %d %d]\n', newRect...

How about naming your figures: S.Fig1 = figure('name','figure1'); S.Fig2 = figure('name','figure2'); Then you can find them with findobj: findobj('type','figure','name','figure2'); This will return the graphics handle if it is open, or be empty if it is closed. So this call will check if the figure exists: ~isempty(findobj('type','figure','name','figure2')) sources: How to check...

You have to update your handles via guidata to take the modifications of handles into account: guidata(hObject,handles); Otherwise the modifications of handles are lost at the end of the callback's execution. Best...

This happen to a Matlab uicontrol when some of it's parameters are set to an invalid value. Matlab choose to not display them. In your case, the error message tells you the Value parameter is incorrect. Your listbox is defined as a "single-selection", which means you can only have one...

I made a function hatch_coordinates which can return hatch pattern coordinates (get the code at the bottom of the anwser). With that, you simply plot your hatch pattern on you axis, then you plot your rectangle on top of it. You have to set the face color of the rectangle...

matlab,user-interface,matlab-guide

I found it out. I had to update my handles with guidata(hObject, handles); "somewhere in the code" again, means, immediately after adding my variables. Greets, hope it helps someone....

matlab,image-processing,matlab-guide

imageSet requires the Computer Vision Toolbox from MATLAB R2014b or higher. See the release notes from the Computer Vision Toolbox here: http://www.mathworks.com/help/vision/release-notes.html#R2014b If you have R2014a or lower, imageSet does not come with your distribution. The only option you have is to upgrade your MATLAB distribution. Sorry if this isn't...

matlab,matlab-figure,matlab-guide,telecommunication

Try elementwise multiplication by adding a dot before *: x = (Ac + m).*cos(2*pi*fc*t); ...

The following line cant work because HitTest is off for the plot handle h set(h,'ButtonDownFcn','disp(''axis callback'')') You need to hold your axes (or change the NextPlot property to be 'add'- otherwise when you create a new plot - the ButtonDownFcn callback of your axes will be cleared. See examples below:...

matlab,matlab-guide,matlab-compiler,nonlinear-optimization

Your function is incorrect as far as I can see. This line: xprime=[ alpha*I*(1-c) + c*(- k_f - k_d - k_n * s - k_p*(1-q)); lambda_b * c* P_C - lambda_r *(1-q)*s; k_p * c *(P_C / P_Q)- gamma * q]; should be: xprime=[ alpha*I*(1-x(1)) + x(1)*(- k_f - k_d...

matlab,user-interface,matlab-guide

You could use a global flag, something like this: global clicked; clicked = true; Then, on your figure1_KeyPressFcn function, you only call the switch if the user has clicked, like this: global clicked; if clicked switch eventdata.Key case 'space' clicked = false; %% processing x task ... end end And...

matlab,matlab-figure,matlab-guide

To get subscripts you can use the LaTeX interpreter. But I don't think the 'xticklabel' property supports TeX or LaTeX. So: remove your xticklabels and create text objects, which does support TeX. To create all text objects at once, you can pass arrays as inputs to the text function: y=[0.3435...

matlab,matlab-figure,matlab-guide

Here's a basic example on how you can do this with 3 plots (save this code as a file and run): function Example %% // Init close all; %% // Example figure figure(201); h(1) = ezplot('sin(x)'); hold on; h(2) = ezplot('cos(x)'); h(3) = ezplot('tan(x)'); %% // Create a UI control...

If you are in the same folder as the m.file, you can enclose the whole uigetfile call to the run function to execute it: run(uigetfile('*.m', 'Pick a .m file')) This way you avoid the naming conflict with you previously defined filename variable and call the result of uigetfile without storing...

matlab,user-interface,matlab-guide

You can update the handles object using guidata(hObject,handles) - look here for more info. After that you should be able to access the value. Your question also mentions exporting to workspace - you could use assignin('base', 'variable', value) - see here...

matlab,matlab-figure,matlab-guide

Error because you wrote function activation with 3 input arguments. You can change the function like: function activation(hObject, handles) cla(hObject,'reset'); axes(hObject); % do what you want here % update handles struct at the end guidata(hObject, handles); And call it in the popup menu by: activation(handles.eeg_final, handles); ...

string,matlab,user-interface,input,matlab-guide

Well, isa() function doesn' t work in this case because all you read from Edit Text is string in other words char. Thus, if you even write isa('123', 'integer'), function returns 0 not 1. Anyway, thanks to MATLAB there is a function: isstrprop() determines whether string is of specified category...

image,matlab,image-processing,video-processing,matlab-guide

Neat problem. Here's what you can do: At program startup, use dir, (like this: filelist = dir('*.bmp')) to get a list of all of the image files in the folder in which you are working. Assign that list to the guidata handles, like so: handles.filelist = filelist. While your at...

matlab,user-interface,image-processing,matlab-guide,matlab-cvst

Unfortunately there is no way to use vision.VideoPlayer in a custom GUI directly. However here an example of how to play a video inside a custom GUI without using vision.VideoPlayer.

Here is a programmatic GUI which does what you want and is, in my opinion, much simpler to understand/debug. You can easily implement this using GUIDE; everything that comes before the pushbutton's callback can be put into the GUI Opening_Fcn. I added comments in the code; if something is unclear...

matlab,matlab-figure,matlab-guide,matlab-deployment,matlab-compiler

I assume you copy-pasted the function syntax from somewhere and that you don't need to return j. Define this function in globalfun.m function score = globalfun(a, xr, x) ... score = gv_0/gv_1; end The value of score is assigned within globalfun and will be set as return value. Then call...

matlab,user-interface,matlab-figure,matlab-guide

Here is a way to do it using imrect and its addNewPositionCallback method. Check here for a list of available methods. In the following figure I create 2 axes. On the left that's the original image and on the right that's the "modified" image. By pressing the pushbutton, imrect is...

image,matlab,image-processing,matlab-guide,roi

imellipse creates a ROI on the figure, which can be removed if you delete the associated ROI object. Let's suppose you have used imellipse like this - Lesion = imellipse(handles.axes1); Then, get all the information that you need from Lesion and then delete it. For example, if you need the...

Ah, I see you're using GUIDE. It's a nice tool for simple, throw-away GUIs, but once you try to do anything neat, you're going to push it past it's limits. Fortunately, there's a better way. You'll need to build your GUI, in part or in whole, with the programmatic GUI...

matlab,matlab-guide,matlab-uitable

I couldn't think of a possibility to achieve what you want with a certain key, I think it would be possible with any key (KeyPressFcn). But I'd rather recommend to introduce a toolbar with a pushbutton: h = figure(... u = uitable(h, ... set(u,'Tag','myTable') tbar = uitoolbar(h); uipushtool(tbar,'ClickedCallback',@addRow); In your...

matlab,matlab-figure,matlab-guide

Is your "figure" actually a dialog? Running this code -> you get a dialog and a second figure which is created when the colormap line is run: close all d = dialog; ax = axes ( 'parent', d ); colormap ( ax, colorcube ); Where as if it is a...

in what order are you executing the above codes ? I first executed second code then the first code and this is my output Here is the whole code I executed, I had to remove the line handle.axis2; as it was throwing an error.( I am using matlab 2011) close...

Let me correct your code to show you the little mistakes you made (I'm not very experienced but I think that can help you). I didn't try to understand the textscan(...) calls since I don't have one of your txt files. function Search_Patient_Callback(hObject, eventdata, handles) % global cell_data (I avoid...

matlab,image-processing,matlab-guide

The following command: Depth = dir (fullfile(myFolderdepth,'shower_depth','*.png')) only gets the relative names of the files. This means that the file names are only retrieved, not the full path to the file. Take a look at the error that you're getting: Error using getImageFromFile (line 11) Cannot find the specified file:...

matlab,user-interface,listbox,matlab-guide

You can group the axes that share the same properties (i.e. are visible or not at the same time) into 1 variable (eg. TopAxes and BottomAxes) and thus update their properties at the same time in the Listbox callback. Here is an example with 6 axes, 3 at the top...

This creates text box: handles.edNama2 = annotation('textbox', [your_position_of_the_text_box_here]); set(handles.edNama2, 'String', ['He needs ', num2str(10), ' $USD!!!']); This opens new message box for you: msgbox(['I want ', num2str(1e+6), ' $USD']); So you can put your info in the [], remember to convert to String type....

matlab,user-interface,matlab-guide

Normally, a figure window can be maximized by obtaining the underlying Java Frame object and calling its setMaximized method: jf = get(handle(gcf), 'JavaFrame'); jf.setMaximized(true) If this doesn't work, the likely reason is that resizing is disabled for that figure window. You should be able to re-enable resizing this way: set(gcf,...

matlab,user-interface,graph,matlab-guide

That's because of your call to figure right after the creation of your data, which indeed creates a new figure outside of your GUI. To solve your problem remove that line, and consider adding the actual axes handles in the call to bar: bar(handles.axes1,1:12, [measles' mumps' chickenPox'], 1) Therefore your...

As an extension of my comment, here is what the doc says about .fig and .m files generated by GUIDE (available here): By default, the first time you save or run a GUI, GUIDE stores the GUI in two files: A FIG-file, with extension .fig, that contains a complete description...

The best thing to start is probably to clear the confusion between plot/subplot/axes/figure etc ... A figure is a "window". Graphic object, created with the similarly named command figure. An axes is also a graphic object. It is a container, which can contains all sorts of other low level graphic...

You have a couple alternatives here. Be aware that callbacks expect 2 input arguments by default so your problem most likely comes from that. I can't find the reference I once saw about this, but you might want to try one of these: 1) In your callback, manually retrieve the...

matlab,events,listener,matlab-guide

The easiest way to temporarily deactivate a listener is by adding a flag to the handles structure. For example, at the beginning of your initialization routine, you set handles.isInitializing=true; guidata(hObject,handles);,and add if handles.isInitializing, return; end to the beginning of the listener callbacks. Remember to set the flag to false at...

A possible solution can be the following. Let's assume you have GUI 1 defined as follows: GUI filename (the name of both the .m and .fig files) = master_gui figure tag property defined as "figure1" figure handlevisibility property set on callback to be called from GUI 2: plot_something_Callback Then from,...

In your button's callback function, don't call guidata(hObject, handles); again, unless your streamSensor_1_2_3() function returns the updated handles. So, simply delete the last line in function printOnce_Callback(hObject, eventdata, handles).

Change pos = sprintf('edit%', i) to pos = sprintf('edit%d', i) That specifies i should be formatted as an integer when building the string....

I have the answer to my question. A summary of changes: Added uiresume (after adding uiwait in the Opening function) after each Callback Deleted close (gcf) after each Callback; if the figure closes, then hObject and handles in guidata are no longer accessible to the Output function Created a handle...

matlab,matlab-figure,matlab-guide,matlab-deployment

I am assuming that the data read in from all of the text files are the same length. If that's the case, then all you have to do is create an empty matrix, then concatenate your results column by column. You simply have to add two lines. % Store the...

matlab,user-interface,matlab-guide

I cant test just now - but I suspect this is because of the callback you are using. The KeyPressFcn is activated when you press the key - that means that it is running before the key you are pressing has registered in the control. The fact you see the...