Prev: Restructuring cell arrays with cellfun
Next: DS
From: Matt Fig on 6 Aug 2010 21:37 If I understand you correctly, you will need to nest your calls to CELLFUN. D = cellfun(@(y) cellfun(@(x)[x(:,1) x(:,3) x(:,2) x(:,4)],y,'Un',0),C,'Un',0) but honestly, is this going to be faster than a FOR loop? Or are you just looking for compact notation?
From: Ashish Uthama on 9 Aug 2010 07:48 An example might help explain the issue you are running into. >> c{1} = [ 1 2 3 4]; >> c{2} = [ 10 20 30 40]; >> b= cellfun(@(cc)[cc(:,1) cc(:,3) cc(:,2) cc(:,4)],c,'Un',false); >> b{1} ans = 1 3 2 4 Could you elaborate on what you mean by 'does not work'. Maybe modify the above to explain what you expected and what you are getting instead.
|
Pages: 1 Prev: Restructuring cell arrays with cellfun Next: DS |