MATLAB: Using “cellfun(@plot..” how do you specify figure assignment similar to plot(fig, X, Y)

cellfunfigureplot

I am trying to execute cellfun in appdesigner and I want the plot output to be displayed on my axis GUI that I set. I would appreciate your help so I could specify that the plot be displayed in the axes figure of my app.
Thanks!

Best Answer

ax = gca(fig);
hold on
cellfun(@(X,Y) plot(ax, X, Y), Cell_with_X, Cell_with_Y)
hold off
However, you could also use
ax = gca(fig);
XY = [Cell_with_X(:), Cell_with_Y(:)].';
plot(ax, XY{:});