How to inverse a cell array and treating cell arrays like matrices
Show older comments
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)
Ameer Hamza
on 21 Apr 2020
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
Jinay Patel
on 21 Apr 2020
Ameer Hamza
on 21 Apr 2020
Can you share a sample example of your data in a mat file?
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!