[Scilab-Dev] cellfun in Scilab

Siddhartha Gairola siddhartha.gairola18 at gmail.com
Wed Mar 29 16:04:17 CEST 2017


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)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20170329/58a9441b/attachment.htm>


More information about the dev mailing list