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
 script not working !!!

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
bedibra Posted - 08/28/2017 : 10:59:43 AM
Dear all,
I have two scripts(in green) that I wrote and which work well when applied separately. But the problem is that when I append the second script to the first, the second is not working no more (see in red)!!
I really appreciate your help.
Thanks
11   L A T E S T    R E P L I E S    (Newest First)
bedibra Posted - 09/01/2017 : 08:06:49 AM
OK thanks
quote:
Originally posted by nick_n

Hi,

I have no ready to use solution for that yet.
Actually, sometimes I use ImageJ to get profiles.
BR,

Nikolay

nick_n Posted - 09/01/2017 : 07:54:13 AM
Hi,

I have no ready to use solution for that yet.
Actually, sometimes I use ImageJ to get profiles.
BR,

Nikolay
bedibra Posted - 09/01/2017 : 07:36:26 AM
dear nick
can you please take a look at this post and let me know what do you think ?
http://www.originlab.com/forum/topic.asp?TOPIC_ID=34570
nick_n Posted - 09/01/2017 : 05:52:38 AM
Hi,

"Scope of Variables

The way a variable is declared determines its scope. Variables created without declaration (only allowed for types double, string, and dataset) become Project variables and are saved with the Origin Project file. Declared variables become Session or Local variables. "

See more: http://www.originlab.com/doc/LabTalk/guide/Data-Types-and-vars#Scope_of_Variables

BR,

Nikolay
bedibra Posted - 09/01/2017 : 05:45:56 AM
indeed, I did not see that.
can you tell me what is the difference between int simax and simax ?
nick_n Posted - 09/01/2017 : 05:22:27 AM
Hi,

Let me back to my previous message.
In your code the variable "simax" is global (undefined) and you get new value for that after range1-3 definition:

range r1 = [profiledata]filtred!wcol($(ii));
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];
sum(r1);
simax=sum.imax;

In this case the value of simax will be "last used" from previous running of script.
Thus, first loop of your script could produce wrong result. To avoid that try to use:

range r1 = [profiledata]filtred!wcol($(ii));
sum(r1);
int simax=sum.imax;
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];

Best,


Nikolay
bedibra Posted - 08/30/2017 : 05:15:33 AM
Finally I found the problem.
All I had to do is to add this two lines (underlined) to the script.


// script de reduce rows
wreducerows irng:=[profiledata]vlineprofile!2 method:=mask orng:=[profiledata]"split data"!1;
// script de split data
range split2=[profiledata]"split data"!2:end;
del split2;
colsplit irng:=[profiledata]"split data"!1 method:=seq nrows:=200 rd:=[profiledata]"split data"!2;
// script de filtred
range filtred=[profiledata]filtred!2:end;
del filtred;
range split=[profiledata]"split data"!;
for(ii=2; ii<=split.ncols; ii++)
{
range source = [profiledata]"split data"!col($(ii));
range target = [profiledata]filtred!col($(ii));
fft_filters (source) oy:= (target);
}
// script de analysis (exclude the last transient)
range analysis=[profiledata]analysis!2:end;
del analysis;
range timems = [profiledata]filtred!1;
range coo=[profiledata]filtred!;
for(ii=2; ii<=coo.ncols-1; ii++)
{
window -a profiledata;
page.active$ = analysis;

range r1 = [profiledata]filtred!wcol($(ii));
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];
sum(r1);
simax=sum.imax;
sum(r2);
col($(ii))[1] = timems(sum.imax)-timems(sum.imin);
col($(ii))[2] = Max(r1);
sum(r3);
smin=sum.min;
col($(ii))[3] =$(smin);
nlbegin iy:=(timems,r3) func:=Exponential nltree:=ParamTree;
nlfit;
nn=ParamTree.R0;
nlend;
Col($(ii))[4]=-1/nn;
}
//get the mean
range results=[profiledata]results!2;
del results;
rowstats irng:=[profiledata]analysis!2:end mean:=[profiledata]results!2 sd:=<none>;

bedibra Posted - 08/29/2017 : 04:57:57 AM
I have tried you suggestions, but it did not work !

quote:
Originally posted by nick_n

Obviously, it should be :

range r1 = [profiledata]filtred!wcol($(ii));
sum(r1);
simax=sum.imax;
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];

and: col($(ii))[3] = smin; //not crucial

Hope it will help. Unfortunately, I have no time to run script right now to test. Best,

Nikolay

nick_n Posted - 08/28/2017 : 7:59:54 PM
Obviously, it should be :

range r1 = [profiledata]filtred!wcol($(ii));
sum(r1);
simax=sum.imax;
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];

and: col($(ii))[3] = smin; //not crucial

Hope it will help. Unfortunately, I have no time to run script right now to test. Best,

Nikolay
bedibra Posted - 08/28/2017 : 6:34:41 PM
// script de reduce rows
wreducerows irng:=[profiledata]vlineprofile!2 method:=mask orng:=[profiledata]"split data"!1;
// script de split data
range split2=[profiledata]"split data"!2:end;
del split2;
colsplit irng:=[profiledata]"split data"!1 method:=seq nrows:=200 rd:=[profiledata]"split data"!2;
// script de filtred
range filtred=[profiledata]filtred!2:end;
del filtred;
range split=[profiledata]"split data"!;
for(ii=2; ii<=split.ncols; ii++)
{
	range source = [profiledata]"split data"!col($(ii));
	range target = [profiledata]filtred!col($(ii));
	fft_filters (source) oy:= (target);
}
// script de analysis (exclude the last transient)
range analysis=[profiledata]analysis!2:end;
del analysis;
range timems = [profiledata]filtred!1;
range coo=[profiledata]filtred!;
for(ii=2; ii<=coo.ncols-1; ii++)
{
range r1 = [profiledata]filtred!wcol($(ii));
range r2 = [profiledata]filtred!wcol($(ii))[1:$(simax)];
range r3 = [profiledata]filtred!wcol($(ii))[$(simax):<end>];
sum(r1);
simax=sum.imax;
sum(r2);
col($(ii))[1] = timems(sum.imax)-timems(sum.imin);
col($(ii))[2] = Max(r1);
sum(r3);
smin=sum.min;
col($(ii))[3] =$(smin);
nlbegin iy:=(timems,r3) func:=Exponential nltree:=ParamTree;
nlfit;
nn=ParamTree.R0;
nlend;
Col($(ii))[4]=-1/nn;
}
//get the mean
range results=[profiledata]results!2;
del results; 
rowstats irng:=[profiledata]analysis!2:end mean:=[profiledata]results!2 sd:=<none>;
nick_n Posted - 08/28/2017 : 5:02:19 PM
Hi,

In order to catch the problem, it's good to have plain text of script. Could you provide that? Best,

Nikolay

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