error on arrayfun function

View: New views
1 Messages — Rating Filter:   Alert me  

error on arrayfun function

by joe_001 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When using arrayfun function I receive the following error message -

error: octave_base_value::cell_value(): wrong type argument 'bool'
error: cellfun: Dimension mismatch

Actual code is below, how can I fix code to avoid this message?


function case_generation4()
 
% Data
A=[1 1 4;
   2 2 4;
   4 0.5 6];

% Engine
n=size(A,1)
Aspan = arrayfun(@(k) A(k,1):A(k,2):A(k,3), 1:n,'UniformOutput', false)
[Aspan(:)]=ndgrid(Aspan(:));
C=reshape(cat(n+1,Aspan(:)),[],n)
endfunction