0

I have a cell array thiscells:

thiscells <1*40 cell>
eacharray of thiscells is 280*3

I have a function (TheFunction) that gets input of cell array that each array is X*2

How can I send a cell array to TheFunction that contain only columns1,3 from each array?

I tried

TheFunction(thiscells{:}(:,1:2)) % tring to send only columns 1,2

But it didn't work

Edit:

working with (but still looking for faster way to do so):

What is did so far

TheFunction(makingNewCells(thiscells,2));

when

makingNewCells:
[newCells]=makingNewCells(oldCells)
for ii=1:max(size(oldcells))
  newCells=oldCells(:,[1 column]);
end
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
JohnnyF
  • 1,053
  • 4
  • 16
  • 31

1 Answers1

0

This question and its answers may be of help - thiscells{:}(:,1:2) is already failing without the call to Thefunction, if I am not mistaken.

For cells, the problem is even worse: add to this impossibility to double-subref that even if it did what you intended it to do, this passes 40 arguments (which are all 280x2 vectors) to Thefunction. I doubt there are (m)any legitimate uses for a function that takes 40 arguments of the same type, instead of having those wrapped in a cell. I would probably try doc cellfun first.

EDIT: just to be clear, I suggest changing Thefunction so that it accepts a cell of 40 matrices of size 280x2), then using

cell_of_twocolumned_arrays = cellfun(@(x)x(:,[1 2]),thiscells)
Community
  • 1
  • 1
Leporello
  • 638
  • 4
  • 12