without for loop
ttechnik: without for loop
Why would you not use a for loop?Not compiled, not tested.
void Fill2D1D(double a2d[][], int e2d, double a1d[], int nElem=EMPTY, int iBeg=0){ if(nElem == EMPTY) nElem = ArraySize(a1d) - iBeg; for(int iLimit = iBeg + nElem; iBeg < iLimit; iBeg++) a2d[iBeg][e2d] = a1d[iBeg]; } ///////// double acr[][6]; ArrayResize(acr, n); double a1d[]; ArrayResize(a1d, n); Fill1D(a1d ...); Fill2d1d(acr, 2, a1d); // acr[x][2] == a1d[x] for x=[0..n-1]Not compiled, not tested.
WHRoeder:
Why would you not use a for loop?
Why would you not use a for loop?
Not compiled, not tested. Not compiled, not tested.
Thank you very much.
I think it has a standard array function.
I do not know how slow it is
Tested:
void FillxDWith1D(double& axd[][], int exd, double a1d[], int nElem=EMPTY, int iBeg=0) { if(nElem == EMPTY) nElem = ArraySize(a1d) - iBeg; int iLimit = iBeg + nElem; for(; iBeg < iLimit; iBeg++) axd[iBeg][exd] = a1d[iBeg]; }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register