I am connecting the database to matlab and compairing the z in matlab with the actual values in database
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Rohit Agnihotri
il 14 Lug 2015
Commentato: Rohit Agnihotri
il 15 Lug 2015
for i=1:100 k(i)=b(i); z=k(i) %s = cell(i,2); % fetchbatchsize=34; %sqlquery='select q_index from dataexport where q_index=(select ALL var_matlab FROM datavariable)';
% sqlquery='SELECT ALL q_index FROM dataexport WHERE q_index =Any (select var_matlab from datavariable)'; sql=['select id from dataexport where q_index=' num2str(z)'];
end
??? Error using ==> horzcat CAT arguments dimensions are not consistent.
Error in ==> compare1 at 17 sql=['select id from dataexport where q_index=' num2str(z)'];
1 Commento
Brendan Hamm
il 14 Lug 2015
Modificato: Brendan Hamm
il 14 Lug 2015
Please use the '{ } Code' button to format the code sections of your question.
Risposta accettata
Brendan Hamm
il 14 Lug 2015
Likely this is because you are transposing the result of
num2str(z)
Notice the error shows:
sql=['select id from dataexport where q_index=' num2str(z)'];
which is fine if z is a column vector
z= [1;4];
sql=['select id from dataexport where q_index=' num2str(z)'];
If it is a row vector, you will get an error about horizontal concatenation:
z= [1 4];
sql=['select id from dataexport where q_index=' num2str(z)'];
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!