cellfun in Scilab

classic Classic list List threaded Threaded
1 message Options
Siddhartha Gairola Siddhartha Gairola
Reply | Threaded
Open this post in threaded view

cellfun in Scilab

Hi all,

I have written an implementation of the cellfun function in Matlab for Scilab.
My current implementation takes n cells and returns a cell which is n*i dimensional (where i is the size of each cell) and contains lists Ai of size m which is the size returned by function f in cellfun(f, c1, c2, ...., cn).

i.e. ans{i} = f(c1{i}), f(c2{i}), ... f(cn{i})

Here is my commit for this -

But as suggested in the comments it should be -
cellfun(f, c1, c2, ..., cn) ->
for i = 1:size(c1, "*")
     ret(i) = f(c1{i}, c2{i}, ..., cn{i});

If I could get some help with this and where am I going wrong, I would be highly grateful because the current commit gives exactly the same answers as the examples given by Matlab here - https://in.mathworks.com/help/matlab/ref/cellfun.html

Thanking you.

Siddhartha Gairola
(IRC : rocko)

dev mailing list
[hidden email]