[Scilab-users] convert matlab code to scilab

Samuel Gougeon sgougeon at free.fr
Mon Oct 28 14:04:36 CET 2019


Le 16/10/2019 à 13:19, Stéphane Mottelet a écrit :
>
> Sorry, I thought you were just asking about the tildas, not the syntax 
> of unique() in Scilab.
>
> Please see
>
> https://help.scilab.org/docs/6.0.2/en_US/unique.html
>
> vs
>
> https://fr.mathworks.com/help/matlab/ref/unique.html
>
> Matlab syntax [C,ia,ic] = unique(___)  with 3 outputs has no 
> equivalent in Scilab.
>

If this output option is required, this request should be urgently 
reported on Bugzilla.
Indeed, some new unique() features have been implemented and pushed on 
the Scilab forge for Scilab 6.1.0 
<https://codereview.scilab.org/#/c/20918/>,
and are pending, in answer to
http://bugzilla.scilab.org/8418http://bugzilla.scilab.org/15522http://bugzilla.scilab.org/15795
Such a request would challenge the third output position.
To me, the third foreseen output -- that is the vector of numbers of 
occurrences -- would be more useful, and faster to compute, so rather to 
appear before possibly ic in the output list.

Please note that ic should be computed as well in case of "r" or "c" option.

Regards
Samuel


> i.e. in Matlab, after  [C,ia,ic] = unique(A) then A=C(ic), i.e. values 
> in ic are the indices of corresponding unique value in C.  They can be 
> recovered with the quick and dirty following loop:
>
> for i=1:length(a)
>      ia(i)=find(a(i)==C)
> end
>
> S.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191028/7cfc1d3c/attachment.htm>


More information about the users mailing list