I’m going to build a GUI in MATLAB. This GUI page should do my settings.
I’ve six radio buttons, Camera One to Six. Under these radio buttons I’ve three additional radio buttons, Crop Side, and then under this section I’ve a Crop Percent slider.
What I want is, I need to select camera button five, for example, and then automatically set the latest setting that I’ve done on the radio buttons in Crop Side and Slider.
For example, once I’ve select the Camera Two button and set Crop Side to ‘Left’ and Crop Percent Slider to 12.
The next time I check it, the value of Crop side and Crop percent will be set to the ‘Left’ and 12, respectively.
I don’t know which kind of variables and which syntax model would be more useful for this purpose.
Here are links to my code and figure:
https://www.4shared.com/account/home.jsp?sId=kcxzI7wiO9gxGRtq&changedir=-gDLNzzw
http://cdn.persiangig.com/download/GFJExIPKMO/Works.zip/dl
In your callback function for each button, include piece of code to save the buttons value and then load those values each time you choose a new camera, e.g. if you have click on camera 5 and then click on radiobutton for crop it could look something like this:
function radiobuttonCrop_Callback(hObject,event)
% <Here is the code you have atm>
% Add this code
load('guiSettings.mat') % Loads a .mat file containing your settings
settings.cam5.crop = get(hObject,'Value'); % Updates settings.crop to the current value
save('guiSettings.mat') % Saves the updates
end
When you click on another camera, e.g. camera 3, load the settings for camera 3 as below:
function radiobuttonCamera3_Callback(hObject,handles)
load('guiSettings.mat')
set(handles.radiobuttonCrop,'Value',settings.cam3.Crop)
set(handles.slider,'Value',settings.cam3.Slider)
and so on.
Note: guiSettings.mat is the file name containing the settings. When loading with load('guiSettings.mat') you will get the variable settings contained in the file. settings is a struct containing all cameras and all settings for the cameras.
I hope this helps.
Related
I have a special needs situation. I need a tool to allow annotating images. So, the WYSIWYG would have an image. I could click on a spot in the image and create a select box. I can size this box to whatever dimension need. I can then add text that will be associated with the box that will show up on a tool tip when the image is viewed.
So basically, need to be able to select an area of the image and save the coordinates of the area position and size, along with accompanying text.
I am developing a GUI in MATLAB and am trying to allow a user to click on an image in order to enable a push button, and then this image will change like a toggle button, but I am struggling and am hoping for some advice, how can this be done?
I've seen that you can put icons on push buttons in MATLAB and that you can extract the position of the mouse on a click, but I can't figure out if these help my situation. I don't want to put the icon on the button because a) its not the look I am going for and b) I want to be able to change the image depending on the state of the button.
Thanks
The key to your problem is ButtonDownFcn. You need to set your images ButtonDownFcn to reference come function which both changes the image displayed, and does whatever else you need it to do. So, for example, say your create you image in you operating function like so:
...
yourImHandle = image(someImage);
set(yourImHandle, 'ButtonDownFcn', {#yourPushbuttonFcn, yourImHandle, otherVar});
...
Where yourPushbuttonFcn is defined elsewhere as:
function yourPushbuttonFcn(yourImageHandle, otherVar)
set(yourImageHandle, 'CData', someOtherImage);
otherVar=otherVar+1; %# Do other things.
end
This will change the image for you, and sets up the platform for you to do other, more complicated things inside the push button function. Let me know if you have any questions.
Good Luck.
I have objects on the dashboards - filters and legends, I've click 'x' on some of the objects because I dont want to display them. Now I want to display them - how can I make them appear on the dashboard again? I've tried remove and add the sheet again, but doesn't bring back everything anymore.
gemmo
When editing your dashboard, select the sheet or object that you wish to manipulate. You should see a small black triangle in the top right corner of the sheet. Pressing on that triangle reveals a menu that allows you to control it's settings -- including which filters and legends are displayed.
Once you've turned on displaying a filter or legend, you can move it where you like, edit its title or format, or change it between tiled and floating to adjust its position.
To unhide Legends, Follow steps as under in the image:
Select floating and adjust Legends as per your requirement and you will get desired results.
How can i display a scrollable grid of images in matlab GUI?
I want something similar to what is shown below
This stackoverflow post describes a way of displaying images in a uitable by setting the 'String' property to an HTML code pointing to an image. But this requires me to save the images to disk which is not an option i would like as these displays are fired up dynamically.
It would also be nice, if i could add a checkbox inside each image so the user can select a subset of them.
You can use this tool. In the gui, you should be able to scroll through. But to have title below every image you might have to edit the tool.
Sample output:
a grid of images http://www.mathworks.in/matlabcentral/fx_files/22387/12/imdisp.jpg
The answer is here:
How can I use scrollbars in MATLAB figure windows when viewing large GUIs?
-> Note: This is a workaround, scrollbars are not available for Matlab-figures
I would suggest to use the tool Prashanth presented in his awnswer and combine it, by putting all elements within the panel.
My data set contains a column named IconUri that contains a full HTTP address to an image located on a web server. This data set is bound to a tablix, and I'd like to display the image in a cell.
1) I've tried to drag an image into the cell, but I can't use expressions as the image itself isn't aware of its parent's (the tablix) data set.
2) I've also tried to apply the image as a cell background, and while this certainly displays the image, it repeats it in horizontal and vertical direction, which is undesirable. The cell shall contain only one copy of the image.
3) I've tried to create a rectangle in the cell, but it will scale to the cell itself and thus the same effect as above.
Is there a way in which this might be done? I'm even open to performing some XML hacking if this is what is necessary. Thank you!
From the toolbox drag an image into your the cell of your tablix:
Then right click on the newly added image in the cell and select Image Properties:
Change the image source to External and then pick the dataset field that contains your product URL:
If you get the dreaded red cross instead of an image when you run the report, triple check that the URL actually does point at a publicly available image.
If your using a file from the file system rather than an image hosted at a url, you need to ensure the file path is in the form of "file:///C:/RDLCTest/TestImage.png".
If your also displaying the report in the ReportViewer control you will need to turn on EnableExternalImages for the report in code, but that isn't needed if your just outputting the report to say a PDF and downloading it
Use Image and in the image properties set the value to something like this
= Code.ConvertTotWebUrl(First(Fields!Logo.Value, "dsOrder"))
I solved this problem by examining the XML code that the editor created for the image, and I moved the relevant tag inside the tablix cell and assigned the appropriate bindings. When I re-opened the editor again, everything fell into place: the image recognizes the data source and compiling as well as rendering works flawelessly.