Author |
Topic  |
|
andreas1
Germany
12 Posts |
Posted - 08/17/2001 : 12:27:20 PM
|
Hi,
I have created a lstbox that shows all the graphs in the project. What I would like to do now is to add a Filter button such that only certain graphs are displayed. Ideal would be if one could use unix type regular expressions to select the graphs to be displayed. Example: For 10 tests there are plots for 100 accelerometers that measure responses in x, y, or z-direction. The graphs are eg named Test2_a57_x, Test3_a64_y, etc. To show all graphs of accelerometers 50-59 of Test3 with x and y-direction responses one would enter "Test3_a5?_[xy]" in a dialog box and only the corresponding graphs are displayed.
Is there such a filter capability in Origin or some subroutine that does the trick ? If not does anyone have a suggestion for an easy implementation.
Thanks a lot,
Andreas
|
|
CStorey
Canada
137 Posts |
Posted - 08/17/2001 : 1:49:17 PM
|
Unfortunately Origin does not have grep-like features or the ability to store more than 1 string longer than 256 chars at once, making your project difficult. But here's how I'd tackle the problem if I were you. (I assume you have Origin Pro and are familiar with LabTalk if you are able to create listboxes and get a list of all graphs)
1) Learn the substring functions: /// Get the char count ////////////// ii=%[%A]; /// All chars left of "_" /////////// %B=%[%A,'_']; /// All chars right of "_" ///////// %B=%[%A,>'_']; /// All chars after given char # //// %B=%[%A,8]; /// All chars between (INC) char #s / %B=%[%A,14:18]; /// All chars after given token # /// %B=%[%A,#2];
// A token can be a word surrounded by ; // white space (spaces or TABS), or a ; // group of words enclosed in any kind ; // of brackets. For example, if:
%A=These (are all) "different tokens"
// then entering the following in the; // Script window:
%B=%[%A,#1];%B= returns These %B=%[%A,#2];%B= returns are all %B=%[%A,#3];%B= returns different tokens
2) Play with a simple case to pick out your info. Try this example.
Type.redirection=1;
%Z="Test2_a57_x Test2_a64_y Test2_a57_x Test2_a64_y Test3_a57_x Test3_a64_y";
pathlength=%[%Z]; Type "There are $(pathlength) chars in my string";
///// Get every Window name /////; %L=""; // empty the string first! numwins=100; For(ijk=1; ijk<=numwins; ijk++) { %B=%[%Z,#ijk]; If (%B!="") ; { %L="%L %B"; } Else { numwins=ijk-1; //one too many attempts Type "There are $(numwins) graphs: %L"; }; };
3) Learn how to read from and write to INI files or use text in worksheets. - Since you have hundreds of graphs you will need to manipulate very large strings. Only the %Z string in LabTalk can be longer than 256 chars. You can store the initial string in a file for safe keeping while you bash away at creating sub lists. When I compiled my list of all graphs I would then break the list down for each "Test" - either creating a worksheet column or INI file entry. Then I would just search the appropriate sub-list given the parameters.
4) About the parameters. I would avoid trying to use grep-like notation and just create a dialog with ranges: Test#__ to __ Accelerometers#__ to __ and x,y checkboxes.
5)Alternately write yourself a DLL using C to do it.
Best of luck. If you post attempts/problems here I'll try to help.
Craig Storey Origin WebRing Member - http://nav.webring.yahoo.com/hub?ring=originwebring |
 |
|
|
Topic  |
|
|
|