cellfun in Scilab

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

cellfun in Scilab

Hi all,

I have written an implementation of the cellfun function in Matlab for Scilab.
https://in.mathworks.com/help/matlab/ref/cellfun.html
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 -
https://codereview.scilab.org/#/c/19114/

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});
end

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.

Regards,
Siddhartha Gairola
(IRC : rocko)

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