How to inverse a cell array and treating cell arrays like matrices

Hi,
I'm using a creation of my own data type. It isnt currently compatible with arrays so things must be done wit for loops instead.
Im looking to find the inverse/pseudo inverse using pinv() of a cell array. Does anyone know how to do this?
Kind regards,
JP

Answers (1)

You first need to convert the cell array to a numeric matrix before calling inv() or pinv(). For example
x = {1 2; 2 1};
x_inv = inv(cell2mat(x));
Result:
>> x_inv
x_inv =
-0.3333 0.6667
0.6667 -0.3333

2 Comments

I tried that but the class type I'm working with cannot be converted to a double. My cell array is filled with cells. Is there a way to invert this whilst keeping all the entries as cells?
Can you share a sample example of your data in a mat file?

Sign in to comment.

Categories

Find more on Operators and Elementary Operations in Help Center and File Exchange

Asked:

on 21 Apr 2020

Commented:

on 21 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!