The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Animation - graph creation and export in quantity

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hillisd@unr.nevada.edu Posted - 07/11/2006 : 5:06:39 PM
Origin Version (Select Help-->About Origin): 7.5
Operating System:Windows XP
Sorry for the simplicity of my question but I am new to the program. I have a .txt file which consists of 16 columns and 20000 rows. Each row will create a 2d graph consisting of 8 points. Each data point is independent of the others. A graph must be created for all 20000 rows then exported to a file, so the .gif format files can be combined into a single animation .gif file. I am a novice on the programming. I am hoping someone has completed a similar task and could give me some advice. Thank you for your help.
2   L A T E S T    R E P L I E S    (Newest First)
bg-phys Posted - 07/19/2006 : 11:36:11 AM

//I have added some comments to the code for clarity.
//If any comments are misleading please correct them and repost.



// This is a comment.
/* This is a multi-line comment.
* It has two lines. */


win -a Data1; // Set Data1 as the active window.
// This also Restores the "Data1" window if it was minimized.
nR=wks.nRows; // Set variable "nR" and "nC" to the number of rows and
nC=wks.nCols; // colums (respectively) in the current worksheet


/* Loop over all rows. */
loop(ii, 1, nR) // just like for(ii=1; ii<nR; ii=ii+1)
{

%A=MyWks$(ii); // Sets string variable "%A" to "MyWks"
// with the value of ii appended to it. (i.e. MyWks1)
win -t wks origin %A; // Open a new worksheet called %A
win -a Data1; // Set Data1 as the active window.
kk=1;


/* Loop over all columns. */
for(jj=1; jj<nC; jj=jj+2)
{
// %A = worksheet
// %A_A = column A of worksheet
// %A_A[5] = 5th row element of column A of worksheet


/* col()[] is of the form: col(colName)[row#]
* col()[] returns the numeric value of the dataset item specified.
* Since no dataset is specified when we use it below, the command uses
* the dataset in the active window. We have just set the active window
* to Data1 a few commands ago.
*/


/* Now we take the data from the Data1 dataset and put it in the %A
* dataset. We do this one data element at a time.
*/
%A_A[$(kk)]=col($(jj))[$(ii)];
%A_B[$(kk)]=col($(jj+1))[$(ii)];
kk++; // same as "kk=kk+1;" which is the same as "kk+=1;"
}


%B=MyPlot$(ii); // Specify output graph name and set it to variable "%B"
win -t plot scatter %B; // Open a new scatter plot window called %B
layer -i %A_B; // Plot dataset %A_B
layer.x.from=0; // Set X-axis to start at 0
layer.x.to=100; // Set X-axis to end at 1
layer.y.from=0; // Set Y-axis to start at 0
layer.y.to=40000; // Set Y-axis to end at 1


sec -p 1; // Pause, this is necessary to wait for the graph is ready
image.filename$=d:\test\%B.gif; // Specify the output file name and path
image.export.pagepixel(gif,640,480,24,0); // Specify the output graph pixel resolution


win -cd %B; // Close the worksheet and delete all of its data.
win -cd %A; // Close the worksheet and delete all of its data.
}




Edited by - bg-phys on 07/19/2006 11:46:54 AM
larry_lan Posted - 07/12/2006 : 03:05:09 AM
Hi:

Suppose your data is organized by XYXYXY... in each row, my idea is, extract data from each row and rearrange it like:
XY
XY
XY
...
to plot the graph. Here is my labtalk script, and suppose Data1 is the original data worksheet.

/////////////////////////////////////////////

win -a Data1;
nR=wks.nRows;
nC=wks.nCols;

loop(ii, 1, nR)
{
%A=MyWks$(ii);
win -t wks origin %A;
win -a Data1;
kk=1;
for(jj=1; jj<nC; jj=jj+2)
{
%A_A[$(kk)]=col($(jj))[$(ii)];
%A_B[$(kk)]=col($(jj+1))[$(ii)];
kk++;
}

%B=MyPlot$(ii); // Specify output graph name
win -t plot scatter %B;
layer -i %A_b;
layer.x.from=0;
layer.x.to=1;
layer.y.from=0;
layer.y.to=1; // Set the layer scale

sec -p 1; // Pause, this is necessary to wait for the graph is ready
image.filename$=d:\test\%B.gif; // Specify the output file name and path
image.export.pagepixel(gif,640,480,24,0); // Specify the output graph pixel resolution

win -cd %B;
win -cd %A;
}


Larry
OriginLab GZ Office

Edited by - larry_lan on 07/12/2006 03:07:05 AM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000