MATLAB: Programmatically scroll to row number in the variable editor

desktopjavaundocumentedvareditor

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.

Best Answer

The full answer with links to a not-so-trivial problem can be found in a guest post on http://undocumentedmatlab.com/blog/variables-editor-scrolling/