Question

i'm converting a MATLAB program in c++ using Armadillo for matrix algebra.

i'm stuck on cell type. someone has some hints?

Was it helpful?

Solution 2

Armadillo has field class!

OTHER TIPS

That's because 'cell' is not really a type - it is a placeholder for anything you want to place in it. The closest thing I can think of in languages such as C# and Python is a 'tuple', which intrinsically can contain anonymous types.

Since C++ does not have a built-in tuple type, I suggest you take a look at Boost, which is a very comprehensive, mature and open-source library for practically anything you need in C++. Under Boost, take a look at the Fusion library, or if you require something not simpler, at the Tuple library.

EDIT as Matt mensioned below, as of TR1, tuples are part of the C++ standard library. See Matt's link here.

Your cell data will likely translate fairly well into a C++ object. I would recommend you examine what your cells contain and see if you could represent it as a class. Then you would be able to create vectors/arrays/matrices of your objects and have them treated similar to cells in MATLAB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top