Programmatically scroll to row number in the variable editor

13 views (last 30 days)
I have time series with millions of rows and I need to check what a particular value in a row and its neighbors look like.
Suppose for simplicity that I have
r = rand(100,1);
If the row I want to inspect is
ii = 50
I do NOT want to print the output on the command window with e.g. r(ii-5:ii+5,:) for the following reasons:
  • the output would clutter my command window
  • I want to keep the command window as thin as possible
  • I want to take advantage of the variable editor functionality, e.g. to keep scrolling if the closest 5 neighbors are not sufficient
Note that simply scrolling the variable editor for very lengthy time series is just unfeasible.
My stab:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
v = desktop.getGroupContainer('Variables');
findjobj(v)
Now, you can see that under DTMaximizedPane > jSpreadsheetScrollPane there is a com.mathworks.mlwidgets.array.ArrayTable object with name 'VariableTable'.
However, once I pop the handle to the desktop with findjobj() (can I access it without?) I am still unsure how to scroll to my selected row of my selected variable. Any input is very much appreaciated.
Also, note that on R2013a you can open a new variable editor
v = matlab.desktop.vareditor.VariableEditor('r')
v.open
but I have no clue on how to scroll it.

Accepted Answer

More Answers (1)

Jan
Jan on 11 Sep 2013
And of course the published FEX submission FEX: programmatically-scroll-variables-editor is extremely useful. When I saw this submission I was very astonished that it has not been implemented by TMW already. Creating a GUI to inspect large data sets requires a powerful method to locate a specific element. This is e.g. Ctrl-G in Matlab's editor to scroll to a specific line, or die small edit field right beside the "1 - 50 of 74,060" counter on top of the list of questions in this forum, which can be used to navigate dozens or hundreds of pages back in time -- ups, there is no such navigator. There is also no smart navigator control in the list of answers of a specific forum user. And the same lack in the FileExchange.
I still remember, that my about 30th comment contained some useful information, but it requires some finger acrobatics and algebra to find it in the list of my comments.
Scrolling in the variable editor by code is not as useful as a dedicated navigator control in the variable editor's GUI would be, but it is an important enhancement. TMW should urgently (I hesitate to use this term in the forum) add powerful navigator to the Matlab IDE and the web site. Anything else produces an amateurish look&feel.
And when I see, that the work-power of the design crew has been invested in ribbons instead, my heart is bleeding.
Thanks, Oleg, for this nice must-have.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!