Hi; I had the same problem and your solution almost worked. But I need to pass and return a 2D array (matrix) to a function in such a situation and have problem with returning matrix! Could you please guide me about that?
I have in MyForm.h
________________
________Code:. . . #include"GlobFcn.h" . . . private: System::Void Analyze_Click(System::Object^ sender, System::EventArgs^ e) { ... int Max_data = 0 std::vector<std::vector<double>> mat_data0(size_r, std::vector<double>(size_c)); std::vector<std::vector<double>> mat_data(size_r, std::vector<double>(size_c)); ... (calculating new values for Max_data and mat_data0) ... mat_data=matNormalize(mat_data0,Max_data); //matNormalize is my function..........here I have "no instance of function template "matNormalize" matches the argument list" massage!
Also, I have MyForm.cpp include:
_____________Code:#include "MyForm.h" #include"GlobFcn.h" ... template <size_t row_size, size_t clmn_size> float mat_Normalize(double (X)[row_size][clmn_size], int Max_data) { //std::vector<std::vector<double>> mat_data; for (int r = 0; r < row_size; ++r) { for (int c = 0; c < clmn_size; ++c) { mat_data[r][c] =X[r][c]/ Max_data; //cout << mat_data[r][c] << endl; } } return mat_data; }
And GlobFcn.h as:
Could you please help me to solve the problem!Code:#pragma once template <size_t row_size, size_t clmn_size> float** matNormalize(double(X)[row_size][clmn_size], int Max_data);




Reply With Quote
