Originally posted by: Margarett
Alex, thanks! It really works fine.
Daniel, I needed to use: "d[i].value". But I didn't know that I can use the dot operator ( .value ). Thanks, I figured it out now!
Please, can I ask one more question? The previous question is part of my task.
I export data from Matlab to Microsoft Access. Then I import the data from Microsoft Access into CPLEX.
But unfortunately there is a problem in the export of data from Matlab.
Please, could you see what my mistake is.
Below is the code for the task:
-
matrix "Q" with a dimension of 3*2 was obtained using a matrix of cells "A";
-
then the matrix "Q" is exported to Microsoft Access with the same dimension (3 rows, 2 columns).
(!) The difficulty is that only the first row of the matrix is written to Microsoft Access (of the three available) and then an error message is displayed:
-
Error using database/insert (line 213) General error
-
Error in test_matlab (line 22) insert(conn, 'Rtu', colnames, Q);
(?) Please, tell me, how is it necessary to add / correct the code in order to record all three rows of the matrix in Microsoft Access?
Q=[];
A={1, [3 5 8]} % array of cells
for j=1:2 % matrix column index
for i=1:3 % matrix row index
if j==1
Q(i,j)=A{1,j};
else
Q(i,j)=A{1,j}(1,i);
end
end
end
Q
conn = database('QWERT', '', '');
colnames = {'u1', 'u2'};
insert(conn, 'Rtu', colnames, Q);
close(conn);
Matlab version is R2014b.
Below there is an archive with files.
Best regards,
Margarett.
#CPLEXOptimizers#DecisionOptimization