How to display table in parts in command window in matlab? - 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.

Related

Warning Dialog Box in 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):

LibreOffice BASIC function - Copy if over a value to a new sheet

I'm trying to create a simple function on a LibreOffice Calc sheet.
I have a table of information where cells A1:K2 has headings (the cells in Row 2 are merged)
all the information runs from A3:K176
The sheet has various functions running on it already, all I need is one more function.
At first I wanted it to automate when i open, but then i thought running the BASIC macro off of a button might be better, so i can edit and then just hit the button once I'm done.
I have the button linked up to run the macro already, but now im stuck... I have tried many ways of writing the code, but it seems that i am just too green to figure it out.
the last time i ran Excel advanced functions i was in high school.
ok, enough talking...
All I need the macro to do is once I hit the button, I need it to check column K and any value > 1 it needs to take that whole row and copy it then go to a target sheet, clear any data on the target sheet. then copy that set of rows to the next open row in the target sheet. possibly even exporting the result to a .txt file as a bonus.
this is a start...
in future I would like to add another button that will do the same function to a array lower down and put that into a different sheet.
Option Compatible
Sub SWD_AwakeningsTrade
Dim i, LastRow
LastRow = Sheets("Card_List").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Awakenings For trade").range("A2:I500").clearContents
For i=2 to LastRow
If Sheets("Card_List").Cells(i,"K").Value = "(>1)" Then
Sheets("Card_List").Cells(i, "K").EntireRow.Copy
Destination:=Sheets("Awakenings For trade").Range("A" & Rows.Count.end(xlUp)
End if
next i
End Sub

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.

how to hide existing uicontrol in Matlab before printing figure?

I am using a Matlab based program that does some nice plots of some model results. It adds uicontrol slides and buttons in figures. I have no expierence with gui programming in Matlab, and I dont need it, I just wanna add on my matlab script a couple of lines to hide slides and buttons. I can do it manually from the property editor and set "Visible" to "off", but I was reading the Matlab manual and it does not explain how to retrieve an existing uicontrol and change its properties. Any hint? I tried this with no luck:
b = get(gcf,'uicontrol');
set(b,'Style','pushbutton','Visible','off');
Thanks
You simply need to access the element from the handles structure and change its property from there.
For example, if the pushbutton is stored in the handles structure like this:
handles.b %// Whatever name you gave it and see in the Property Inspector
you can make it not visible using the command
set(handles.b,'Visible','off')
and likewise for every other properties.
Little trick: If you need to repeatedly turn on and off elements of your GUI, you can put them in an array of handles for example in the Opening_Fcn of the GUI and change them all at once using this array anywhere in the GUI. This way you won't have to always call them one by one which can be tedious.
Example:
handles.AllButtons = [handles.button1; handles.button2; handles.button3]
this contains the handles to 3 pushbuttons let's say. Now if yu need to turn them all off/on at the same time, you can do:
set(handles.AllButtons,'Visible','off')
instead of doing
set(handles.button1,'Visible','off')
set(handles.button2,'Visible','off')
set(handles.button3,'Visible','off')
From GUIDE, you can check the actual name of any uicontrol component in the Property Inspector. Here is a screenshot from a GUI I made with GUIDE:
In this case, the Tag associated with the button is pushbutton28_ReferenceChannelApply.
Therefore, in order to change any of its properties I would need to use:
set(handles.pushbutton28_ReferenceChannelApply,'Property','value')
EDIT 2
You can look for pushbuttons in your GUI with the findobj command like so:
FindButtons = findobj('Style','push')
which will output an array of handles to those pushbuttons. Then you can query their properties using the get command:
get(FindButtons(1))