I am new to vector programming in C++. I want to initialize 2D matrix of unknown size so i came to vector side. I have two files 1) .h and 2).cpp. In .h file i initialized the vector like this
vector<vector<double> > vector_stor;
Then in .cpp after getting the size of each dimension from another source i re-sized the vector like this
size_X=5; //assumption
size_Y=5; //assumption
vector_stor.resize(size_X);
for(int i=0;i<size_X;i++)
vector_stor[i].resize(size_Y);
Now i want to store a data from a .mat file, initially read by matIO library, using Mat_VarRead function like this
Mat_VarReadData(vector_stor); //there are other arguments also but for demo just assume it
Mat_VarReadData take arguements in void* data and i have 2D vector. When i am doing like this its giving error
Error 1 error C2664: 'Mat_VarReadData' : cannot convert parameter from 'std::vector<_Ty>' to 'void *'
Can anyone please guide me that how i can do this? It will be very helpful for me.
Edited Part:
matvar = Mat_VarReadInfo(mat,"data_struct");
field=Mat_VarGetStructFieldByName(matvar,"vect_stor",0);
int start[2]={0,0};
int stride[2]={1,1};
int edge[2];
edge[0]=field->dims[0];
edge[1]=field->dims[1];
Mat_VarReadData(mat,field,vector_stor,start,stride,edge);
where vector_stor is the variable for what i am seeking help.
Thanks