[Scilab-users] Vectorfind with accuracy

classic Classic list List threaded Threaded
7 messages Options
Iza Iza
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Vectorfind with accuracy

Hello,

I am wondering if it is possible to use "vectorfind" function with a
given accuracy so it could find equal vectors even when there is a
slight difference between their elements.

Thank you in advance.
Kind regards,
Iza
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

Hi Iza,

Why not rounding-off both inputs to the desired accuracy before vectorfind?

Regards,
Rafael

-----Original Message-----
From: users <[hidden email]> On Behalf Of Izabela Wójcik-Grzaba
Sent: Monday, November 12, 2018 5:16 PM
To: [hidden email]
Subject: [Scilab-users] Vectorfind with accuracy

Hello,

I am wondering if it is possible to use "vectorfind" function with a given accuracy so it could find equal vectors even when there is a slight difference between their elements.

Thank you in advance.
Kind regards,
Iza
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

In reply to this post by Iza
Le 12/11/2018 à 16:15, Izabela Wójcik-Grząba a écrit :

> Hello,
>
> I am wondering if it is possible to use "vectorfind" function with a
> given accuracy so it could find equal vectors even when there is a
> slight difference between their elements.
>
> Thank you in advance.
> Kind regards,
> Iza
> _______________________________________________
> users mailing list
> [hidden email]
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users 
>
Hello,


Please find attached a tweaked version of vectorfind with a fourth
argument "tol". It can output the following stuff

alr=[1,2,2;
      1.0001,2,1;
      1,1,2;
      1,1,1;
      1,2,1];

ind = vectorfindtol(alr,[1,2,1],'r',1e-4)

  ind  =

    2.   5.

S.

--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

vectorfindtol.sci (2K) Download Attachment
Iza Iza
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

Thank you Stéphane and please ignore my last post - I didn't see the
attachement at first.
I wanted to put your function to the library and have it loaded at
startup of each session. I used the function:

genlib ("Moja_biblioteka","C:/Program Files/mojabiblioteka_scilab")

and created a scilab.ini file in SCIHOME in which I put a line:

Moja_biblioteka = lib("C:/Program Files/mojabiblioteka_scilab")

Now your function vectorfindtol works only for the first time after
starting Scilab and only in the console. When I want to use it in a .sce
file it doesn't work at all. I get the message: "Undefined variable:
vectorfindtol".

Am I doing something wrong or did I miss something?

Thanks,
Iza





W dniu 12.11.2018 17:52, Stéphane Mottelet napisał(a):

> Le 12/11/2018 à 16:15, Izabela Wójcik-Grząba a écrit :
>> Hello,
>>
>> I am wondering if it is possible to use "vectorfind" function with a
>> given accuracy so it could find equal vectors even when there is a
>> slight difference between their elements.
>>
>> Thank you in advance.
>> Kind regards,
>> Iza
>> _______________________________________________
>> users mailing list
>> [hidden email]
>> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
>
> Hello,
>
>
> Please find attached a tweaked version of vectorfind with a fourth
> argument "tol". It can output the following stuff
>
> alr=[1,2,2;
>      1.0001,2,1;
>      1,1,2;
>      1,1,1;
>      1,2,1];
>
> ind = vectorfindtol(alr,[1,2,1],'r',1e-4)
>
>  ind  =
>
>    2.   5.
>
> S.
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

Le 13/11/2018 à 16:42, Izabela Wójcik-Grząba a écrit :

> Thank you Stéphane and please ignore my last post - I didn't see the
> attachement at first.
> I wanted to put your function to the library and have it loaded at
> startup of each session. I used the function:
>
> genlib ("Moja_biblioteka","C:/Program Files/mojabiblioteka_scilab")
>
> and created a scilab.ini file in SCIHOME in which I put a line:
>
> Moja_biblioteka = lib("C:/Program Files/mojabiblioteka_scilab")
>
> Now your function vectorfindtol works only for the first time after
> starting Scilab and only in the console. When I want to use it in a
> .sce file it doesn't work at all. I get the message: "Undefined
> variable: vectorfindtol".
>
> Am I doing something wrong or did I miss something?

Likely a "clear" instruction at the beginning of your script.
This is a Matlabers habit. And just an atomic bomb for Scilab. It
deletes all what is deletable around, including users functions, users
libraries not autoloaded, etc.

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Iza Iza
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

Thanks Samuel, you are right. I use "clear" because while testing my
programmes I have to use different values of variables and sometimes
it's difficult to find an error in the code especially when some of
variables have old values. There are a lot of different variables in my
codes so it would be hard to list them. Is there any other way to do it?

Iza




W dniu 13.11.2018 23:12, Samuel Gougeon napisał(a):

> Le 13/11/2018 à 16:42, Izabela Wójcik-Grząba a écrit :
>> Thank you Stéphane and please ignore my last post - I didn't see the
>> attachement at first.
>> I wanted to put your function to the library and have it loaded at
>> startup of each session. I used the function:
>>
>> genlib ("Moja_biblioteka","C:/Program Files/mojabiblioteka_scilab")
>>
>> and created a scilab.ini file in SCIHOME in which I put a line:
>>
>> Moja_biblioteka = lib("C:/Program Files/mojabiblioteka_scilab")
>>
>> Now your function vectorfindtol works only for the first time after
>> starting Scilab and only in the console. When I want to use it in a
>> .sce file it doesn't work at all. I get the message: "Undefined
>> variable: vectorfindtol".
>>
>> Am I doing something wrong or did I miss something?
>
> Likely a "clear" instruction at the beginning of your script.
> This is a Matlabers habit. And just an atomic bomb for Scilab. It
> deletes all what is deletable around, including users functions, users
> libraries not autoloaded, etc.
>
> Samuel
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Vectorfind with accuracy

Hello Izabela,

Le 14/11/2018 à 15:07, Izabela Wójcik-Grząba a écrit :
> Thanks Samuel, you are right. I use "clear" because while testing my
> programmes I have to use different values of variables and sometimes
> it's difficult to find an error in the code especially when some of
> variables have old values. There are a lot of different variables in
> my codes so it would be hard to list them. Is there any other way to
> do it?

You may put less code in your main script, and build and put more code
in functions.
functions are also useful to isolate some pieces of code and their
internal environment, from the calling level.
When leaving a function, all internal variables are automatically forgotten.
This might help a lot in building complex and reliable
programs/computations.

Best regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users