Warning Dialog Box in MATLAB - matlab

I run a very completed piece of MATLAB code containing hundreds of variables and sometimes I forget to change value of variables/parameters. I want to create a dialog box that pops up and notifies me about values of my variables prior to execution of the program.

You could use one of the predefined dialog boxes, such as inputdlg. The first example in the documentation shows how you can allow the user to modify multiple values (with defaults):

Related

How to display table in parts in command window in matlab?

I have a table which consists of 17025 rows. When I try to display the table, the whole table displays. But I want it in small parts. How do I make it display in small parts.
Type more on at the MATLAB command prompt. Subsequent output will be paused after every screenful.
Documentation: https://www.mathworks.com/help/matlab/ref/more.html
I usually check my variables in these ways:
Suppose that we have a variable called A=rand(1000,1000).
1.we can display a part of A by calling A(127:130,241:243), to show the specific part of it.
>> A(127:130,241:243)
ans =
0.8152 0.0674 0.5609
0.1977 0.3906 0.6491
0.3288 0.1255 0.7478
0.9176 0.4253 0.5111
2.double click the name of the variable in the Workspace, so we could check it in Variables.
3.if your data only contain few columns, I recommend you to draw them in a figure and view them by dragging a Data Cursor in the picture.
SampleCode:
A=[1:1:200; 250:-1:51];
plot(A')
However, only the first option could display matrix on command window, but 2&3 is much faster since we don't know which part to display.

MATLAB uitable created by GUIDE to update data sets

I'm currently working on a GUI that has a uitable within it. The idea is to allow the user to input a string and press a button to add a new row of cells, like so: ui_table_currently.
In addition to this, when the user clicks 'accept', the data set so far would be saved. This means if the user were to load up the GUI again, the same data set would be shown as when they closed down the GUI.
In practice, I've managed to save the data set with the users input into the workspace in MATLAB, however, I cannot update the data set that is shown in the uitable when I reload the GUI, unless I use GUIDE and change uitable via (Inspector > Table Property Editor > Data > Change data value to the selected workspace variable).
My question is this: How do I get uitable to retain the data set it has when I close it, without manually having to change it through GUIDE?
You should have two files created with GUIDE. For the sake of example, let's say your's are named raimo.fig and raimo.m. Let's also say you gave your uitable the tag, 'table_1'.
If you edit the raimo.m file, you should see a line like this
% --- Executes just before analysis is made visible.
function raimo_OpeningFcn(hObject, eventdata, handles, varargin)`
Load your data from the file within this function, and then give it to your user data.
Here's a made up example of how to do it:
a = load('yourAmbiguousData');
set(handles.table_1,'table',a);
I don't know how your data is saved, or what is called, but if you have pulled it out of your uitable correctly, you can just put it back in there with a set command.

Bokeh - How to use box tool without default selections?

I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.

Access debug variables from within the code

It's about debugging in eclipse,
While debugging, I can see Variables window containing the variable names and their values, how can I access those variables and get their values from within the code or (expression) window?
For example can I write something like this:
print cash.dbname
or
x=cr.IN_MAX
or
s = _pool._serialized
(See the picture)
There's a very complex tree of variables, can I also access this variable tree reaching the branches and leaves?
Open the Display view; there you can enter code snippets that execute within the current stack frame selected in the Debug view. Code completion works, too.
You can select part or all of the contents of the Display view, right-click, and choose to Display, Inspect, or Execute it. Very powerful for exploring application state when debugging.
See also the Eclipse Help page about Display View.

Display checkbox inside a listbox

In my (programmatic) Matlab GUI, I have a listbox uicontrol.
What I want is to display checkboxes in front of each option. When a user clicks the checkbox, it's marked (and the element will be considered during the calculations later). While if the user clicks the label, a description of the selected option will be displayed in a text uicontrol to inform the user what the option means.
Basically, I want functionality similar to installation programs where you can select components to install and can get information about said components by clicking them (which does not necessarily mark them as selected).
Is there a way to do this with checkboxes or something similar?
There are actually 2 built-in controls that you could use within Matlab:
com.jidesoft.swing.CheckboxList
com.mathworks.mwswing.checkboxlist.CheckBoxList
Usage example (more details in my Matlab-Java book):
jList = java.util.ArrayList; % any java.util.List will be ok
jList.add(0,'First');
jList.add(1,'Second');
jList.add(2,'Third');
jList.add(3,'and last');
jCBList = com.mathworks.mwswing.checkboxlist.CheckBoxList(jList);
jScrollPane = com.mathworks.mwswing.MJScrollPane(jCBList);
[jhCBList,hContainer] = javacomponent(jScrollPane,[10,10,80,65],gcf);
set(jCBList, 'ValueChangedCallback', #myMatlabCallbackFcn);
jCBModel = jCBList.getCheckModel;
jCBModel.checkAll;
jCBModel.uncheckIndex(1);
jCBModel.uncheckIndex(3);
There's no "ready" way for doing that - as listboxes take only plain strings as entries.
You could "manually" draw checkbox fitted into the area of the listbox, but that might mean quite a lot of work to get everything working...
Another alternative is to go for a java-componenent - e.g. using the jide components available in matlab. See e.g.
http://undocumentedmatlab.com/blog/using-jide-combo-boxes/
for a few examples.