Reza_M
Reza_M

Reputation: 439

Square root of cell array in matlab

I have a cell array A={<2x6 double>,<4x6 double>,<16x6 double>} and I want to calculate the square root of all elements of this cell array. for a single matrix, it is so simple to use sqrt but for cell array, is there any solution? THX in advance

Upvotes: 1

Views: 445

Answers (1)

scmg
scmg

Reputation: 1894

Try arrayfun:

B = arrayfun(@(i) sqrt(A{i}), 1:length(A), 'Uni', 0);

Upvotes: 2

Related Questions