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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Deviding dataset using variable + find x to y
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fluoroxid97

Germany
1 Posts

Posted - 11/20/2019 :  5:44:48 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System: Windows 10

I have a dataset that consists of x going from min to max and back to min again. After import, I want to run a script that reports some important merits.

The first task is to devide the dataset in two parts as a forward and backward part by using the maximum as a reference point. I tried using the xindex function which works if the newly defined integer is used as the upper end range parameter. However [parameter:end] for the second set of data does not... Is there any smart way to handle this?
Here the script:

string str3$ = Col(A)[D1]$;
Col(C)=Col(B)/%(str3$);
Col(C)[L]$ = j;
Col(C)[U]$ = mA/scm;

double maxx = max(Col(A));
int ligma = xindex(maxx,Col(B));
dataset Vfor = Col(A)[1:$(ligma)];
dataset jfor = Col(C)[1:$(ligma)];
dataset Vback = Col(A)[$(ligma):end];
dataset jback = Col(C)[$(ligma):end];


The second part consists mainly in taking the values at x=0 and y=0 followed by some calculations. I first worked with the Lookup function, however putting zero it takes some random small value but not the one closest to 0, since i guess the sicentific notation messes this up...
Then i went to use interpolation. I tried different ways of defining this, using the range notation and also the dataset one. In the end, all values are far away from what should be the result.

dataset powerfor = Vfor*jfor;
double pmaxfor = min(powerfor);
double ppmaxfor = abs(pmaxfor);
double jSCfor = jfor(0.000,Vfor);
double VOCfor = Vfor(0.5,jfor);
double FFfor = ppmaxfor/(jSCfor*VOCfor)*(-1);

Col(D)[1]$= PCE (%);
Col(D)[2]= ppmaxfor;
Col(D)[3]$= jSC (mA/scm);
Col(D)[4]= jSCfor;
Col(D)[5]$= VOC (V);
Col(D)[6]= VOCfor;
Col(D)[7]$= FF;
Col(D)= FFfor;
Col(D)[9]$= Sample;
string str2$ = Col(A)[D3]$;
Col(D)[10]$= str2$;
Col(D)[11]$= Contact;
string str1$ = Col(A)[D4]$;
Col(D)[12]$= str1$;

dataset powerback = Vback*jback;
double pmaxback = min(powerback);
double ppmaxback = abs(pmaxback);
double jSCback = jback(0,Vback);
double VOCback = Vback(0,jback);
double FFback = ppmaxback/(jSCback*VOCback)*(-1);

Col(E)[1]$= PCE (%);
Col(E)[2]= ppmaxback;
Col(E)[3]$= jSC (mA/scm);
Col(E)[4]= jSCback;
Col(E)[5]$= VOC (V);
Col(E)[6]= VOCback;
Col(E)[7]$= FF;
Col(E)= FFback;
Col(E)[9]$= Sample;
string str2$ = Col(A)[D3]$;
Col(E)[10]$= str2$;
Col(E)[11]$= Contact;
string str1$ = Col(A)[D4]$;
Col(E)[12]$= str1$;

//Col(C)[C]$= $(ppmax,.2) (%) / $(jSC,.2) (mA/scm) / $(VOC,.2) (V) / $(FF,.2);

wcolwidth irng:=col(4) width:=15;
wcolwidth irng:=col(5) width:=15;
wks.col4.type=2;
wks.col5.type=2;
colHide (2) hide;
Col(D)[L]$ = forward;
Col(E)[L]$ = backward;


I am really sorry if I approached it very complicated and it really is simple to solve. However, it is just the third script I did try now.

Thanks a lot for any help already!

Cheers

yuki_wu

896 Posts

Posted - 11/26/2019 :  01:26:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

#1 I think you could get the index of maximum value first, then use X-Funtion colsplit to split column:
https://www.originlab.com/doc/X-Function/ref/colsplit

#2 Try to use LabTalk function table:
https://www.originlab.com/doc/LabTalk/ref/Table-func

Regards, Yuki
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000