MATLAB: How to swap the elements in two arrays

cell arrayswap

Hi, I have these two arrays:
a={'sin', {0, '2*pi', 'pi/100'}, logical([0 1 1 0])};
b={'cos',{'-pi','pi','pi/15'},logical([0 0 0 1])};
Now I want to swap the third cell in a and b?
Thanks!

Best Answer

Do you mean this?
[a{3}, b{3}] = deal(b{3},a{3});
Related Question