Programmatically scroll to row number in the variable editor

조회 수: 4 (최근 30일)
Oleg Komarov
Oleg Komarov 2013년 6월 22일
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.

채택된 답변

Oleg Komarov
Oleg Komarov 2013년 9월 11일
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/

추가 답변 (1개)

Jan
Jan 2013년 9월 11일
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.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by