필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

surpress output of MySQL connection function

조회 수: 1 (최근 30일)
Léon
Léon 2012년 9월 25일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I'm wondering if I can surpress the output of my function:
function [reference, suspect] = sqldata( host,db,user,password,reference_tbl,suspect_tbl)
%%Create DB Connection
clear conn
conn = database(db, user, password, ...
'com.mysql.jdbc.Driver', ...
['jdbc:mysql://' host ':3306/' db]);
%%Fetch Data
setdbprefs('DataReturnFormat','cellarray');
e = exec(conn,['SELECT * FROM ' reference_tbl]);
e = fetch(e);
reference = e.Data;
e = exec(conn,['SELECT * FROM ' suspect_tbl]);
e = fetch(e);
suspect = e.Data;
end
using the ';' when using the function doesn't work however …
Help is greatly appreciated.
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 9월 26일
Which of the lines is producing the output ?
Léon
Léon 2012년 9월 26일
I suppose reference = e.Data and suspect = e.data
I figured out that when I manually 'clear all' and run the function then everything is fine. When doing that twice in a row, then data doesn't seem to be fetched but output appears. Although I have 'clear all' in my script as well but is being ignored. Connection is closes as well using close(conn).

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by