How to convert vector or matrix to double array?

 

I want to calculate the data through matrix and convert the one vector to array for indicator show. 

And it is found there is no output array function in matrix or vector. the "row" or "col" member only output vector.

https://www.mql5.com/en/docs/basis/types/matrix_vector


Is it necessary the get all elements through loop into array?

Documentation on MQL5: Language Basics / Data Types / Matrices and vectors
Documentation on MQL5: Language Basics / Data Types / Matrices and vectors
  • www.mql5.com
Matrices and vectors - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
chenyu468:

I want to calculate the data through matrix and convert the one vector to array for indicator show. 

And it is found there is no output array function in matrix or vector. the "row" or "col" member only output vector.

https://www.mql5.com/en/docs/basis/types/matrix_vector


Is it necessary the get all elements through loop into array?

You can use the method Swap: m.Swap(a) or v.Swap(a) - where m is a matrix, v is a vector, and a is an array (of type double or float, which should match the type of the matrix/vector). After the call the original matrix or vector becomes empty, because it's data is transferred into the receiving array directly.

Unfortunately, this information is not explicitly stated in the documentation.