Hi, suppose I have a matrix defined this way:
If I want to set the first dimension of the matrix, I can simply use, for instance,
However, how can I change the second dimension of the matrix? Is there any option to initialize the matrix with two variable dimensions?
Thanks in advance.
See also this article https://www.mql5.com/en/articles/567#oop who propose a solution.
If you explain why you need this kind of dynamic array, we can search the best implementation. As you wish.
![MQL5 Programming Basics: Arrays MQL5 Programming Basics: Arrays](https://c.mql5.com/36/3/mql5-programming-basics-arrays.png)
- 2013.03.11
- Dmitry Fedoseev
- www.mql5.com
Hi Figurelli and Alain,
I already came up with a solution... I used two nested for loops and everything works perfectly... It's not elegant, but it works... :-D
Anyway, that's a very intriguing design pattern... I don't know if this is how it's supposed to work in C++...
And Alain, thanks for the interesting link !
P.S.: this matrix library is also very interesting to use in MQL5.
Hi Figurelli and Alain,
I already came up with a solution... I used two nested for loops and everything works perfectly... It's not elegant, but it works... :-D
Anyway, that's a very intriguing design pattern... As I'm not a programmer, I don't know if this is how it's supposed to work in C++...
And Alain, thanks for the interesting link !
P.S.: this matrix library is also very interesting to use in MQL5.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, suppose I have a matrix defined this way:
If I want to set the first dimension of the matrix, I can simply use, for instance,
However, how can I change the second dimension of the matrix? Is there any option to initialize the matrix with two variable dimensions?
Thanks in advance.