[scilab-Users] Need help on a scilab function

Mathieu Dubois mathieu.dubois at limsi.fr
Thu Dec 15 00:43:58 CET 2011


Hello,

Le 14/12/2011 15:39, Rémi Chaussenot a écrit :
> Hi Everybody,
>
>
> A collegue makes me a function on MatLab, but i use SciLab, and its not
> working at all.
>
>
> That's the function :
>
> function newTab = countAlone(filename, sheet)
> tab = xlsread([filename '.xlsx'], sheet);
> [count values] = hist(tab, unique(tab));
> newTab(:, 1) = values;
> newTab(:, 2) = count;
> xlswrite([filename '_new.xlsx'], newTab, sheet);
>
>
> I know that i must add a "endfunction" at the end, and use xls_read
> instead of xlsread.
> But, don't change anything, same bugs.
>
I don't think this is a bug. In any case, there are several mistakes in 
your code:
  - to concatenate strings in scilab, use +: filename+'.xlsx'.
  - to read data from an xls file you should use readxls (see help).
  - if I understand correctly, you want to count how many time each 
value appears in a vector. Have a look at the tabul function in scilab.

Finally I'm not sure that scilab can write Excel file.

Mathieu

> Could you help me please ?
>
>
> Thanks a lot,
>
>
>
>
>
> --
> Rémi CHAUSSENOT
> PhD
>
> Centre de Neurosciences Paris-Sud (CNPS)
> remi.chaussenot at u-psud.fr <mailto:remi.chaussenot at u-psud.fr>
>



More information about the users mailing list