matlab-guide

Matlab uitable data selection

好久不见. 提交于 2019-12-22 11:18:00
问题 I have Uitable with data read from a AScii file. I want to select columns using mouse and also using checkboxes. I tried a lot but i cannot figure out how to select uitable column using mouse and getting that data. Also I am trying to insert checkbox in the last row of the uitable, so when user selects checkbox, particular column is selected. Any idea? 回答1: You should edit the CellSelectionCallback and the CellEditCallback properties of your table. set(myTable,`CellSelectionCallback`,

How can I fill an area below a 3D graph in MATLAB?

泪湿孤枕 提交于 2019-12-22 06:29:43
问题 I created the following 3d plot in MATLAB using the function plot3 : Now, I want to get a hatched area below the "2d sub-graphs" (i.e. below the blue and red curves). Unfortunately, I don't have any idea how to realize that. I would appreciate it very much if somebody had an idea. 回答1: You can do this using the function fill3 and referencing this answer for the 2D case to see how you have to add points on the ends of your data vectors to "close" your filled polygons. Although creating a

Hatch a plot in MATLAB

淺唱寂寞╮ 提交于 2019-12-22 01:04:15
问题 I use this code in order to generate a graph: And I must to hatch everything outside the square. pos = [3.75 5.6 53.5 29.5]; %spatiul nemasurat axis([0 61 0 45]) %axele set(gca,'YTickLabel',{'0', '7.5','11.85', '16.2', '20.55', '24.9', '29.25', '33.6', '39.3', '45'}) rectangle('Position',pos,'EdgeColor','black') 回答1: 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

How to remove axis in MATLAB

僤鯓⒐⒋嵵緔 提交于 2019-12-19 19:54:59
问题 axis off Not working. function displayResults(filename,hObject, eventdata, handles) % Open 'filename' file... for reading... fid = fopen(filename); for N=6:1:10 imagename = fgetl(fid); if ~ischar(imagename), break, end % Meaning: End of File... [x,map]=imread(imagename); rgb=ind2rgb(x,map); ax = handles.(sprintf('axes%d', N)); axis off; image(rgb, 'Parent', ax); end guidata(hObject,handles) Above code results in following output: I've highlighted axis in above figure. All images I've used is

save GUI figure in matlab

陌路散爱 提交于 2019-12-18 09:34:27
问题 let us consider following program for graphical user interface function varargout = quadratic(varargin) % QUADRATIC MATLAB code for quadratic.fig % QUADRATIC, by itself, creates a new QUADRATIC or raises the existing % singleton*. % % H = QUADRATIC returns the handle to a new QUADRATIC or the handle to % the existing singleton*. % % QUADRATIC('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in QUADRATIC.M with the given input arguments. % % QUADRATIC(

Global (shared) variables in Matlab GUI code behind. Is there better way to do it then using handles structure?

喜夏-厌秋 提交于 2019-12-18 09:05:19
问题 I have spent some time lately creating complex Matlab GUI tool. I'm using GUIDE GUI builder. I dislike the way Matlab manages global variables in code behind (the .m file with functions). If I want to share data between function calls I have to store them in handles structure that is given as a parameter to every function call. I consider it to be bug prone as I have to mind storing and updating handles all the time. It is rather unnatural for me to handle global variables this way. Using

Running a GUI requires opening the .fig file in GUIDE

若如初见. 提交于 2019-12-18 07:08:16
问题 I am trying to run a MATLAB GUI I have created. If I open the .fig file using GUIDE and press the run button there, it runs perfectly. However, when I double-click the .fig file in the 'Current Folder' section of MATLAB, it seems to be unable to find the handles variable. This causes it to give an error whenever handles is used. Why does this happen? Is there a fix/workaround? I'm using MATLAB R2011, but I've tried it on R2012 as well. The code runs fine, and displays the GUI fine, but the

how to replace the variable value permanently

瘦欲@ 提交于 2019-12-14 04:08:31
问题 I am trying to update a variable value permanently in Matlab. I want to make a GUI where there will be a button which would have variable's value (e.g. k = 3), I will add that with 4 and show the value (e.g. 7) in a text box. Now the value (i.e. 7) will be the new value of k. So if again I click on the button it would show the updated value in text box (e.g. k=7, in text box: 7+4 =11). I am new in matlab and tried many ways to solve it. The simplest way was: function addition_Callback(hObject

How to block possibility to edit/drag impoly in matlab?

跟風遠走 提交于 2019-12-14 03:57:58
问题 I create a polygon on image_area in matlab. I used impoly. But after creation polygon. I need to block possibility to move and drag impoly (ROI is already created). I don't know how I should do it ? I would appreciate for any help please. 回答1: You can set the makeConstrainToRectFcn such that it is a rectangle encompassing your ROI, then whenever you try to move the latter it won't work. You can also, after creating the ROI, set the setVerticesDraggable method to false in order to prevent

Problems with GUI, unable to use handles to store variables

故事扮演 提交于 2019-12-14 02:53:32
问题 I am creating a GUI where a user inputs a value and when he presses a pushbutton it runs an external function and displays error messages. I am having trouble with inserting the variable successfully in the GUI coding. I am confused as to where to insert my variable. I have tried handles but unfortunately its not working. % --- Executes just before Stallfunction is made visible. function Stallfunction_OpeningFcn(hObject, ~, handles, varargin) % This function has no output args, see OutputFcn.