Undefined function 'fetch' for input arguments of type 'struct'

11 ビュー (過去 30 日間)
Steve Proctor
Steve Proctor 2017 年 8 月 31 日
コメント済み: Walter Roberson 2019 年 3 月 13 日
Just got a computer refresh (replace) at work and now my scripts aren't working. Fails with an error of "Undefined function 'fetch' for input arguments of type 'struct'. I believe it's not actually the data type but system settings that are at fault since the same scripts worked on the previous computer.

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 9 月 1 日
It sounds to me as if you do not have the database toolbox installed or licensed. Or perhaps the datafeed toolbox, or the financial timeseries toolbox; hard to say which without more information.
  9 件のコメント
Steve Proctor
Steve Proctor 2019 年 3 月 13 日
  1. How do you save a DB connection? If each script I'm running pulls data from a separate DB, would saving the connection really streamline the code?
  2. Is there a Matlab example of better code to assign contents of cursor? IIRC the sequence Summer used above was taken from the same example I used.
  3. I see SetDBPrefs has a field 'DataReturnFormat' but the only example used is 'Table'. What options are available?
Walter Roberson
Walter Roberson 2019 年 3 月 13 日
You show a function User_insert_Callback. Is that the only function that needs to access the FACE database? Is the user only going to click on the function once, or only at comparatively large intervals compared to accessing other databases?
if ~isfield(handles, 'FACEconn')
handles.FACEconn = database('FACE', 'root', '');
guidata(hObject, handles);
end
curs = exec(handles.FACEconn, ['SELECT user_t.User_id'...
' , user_t.Name'...
' , user_t.Phone_number'...
' , user_t.Email'...
' , user_t.Department'...
' , user_t.DT_ID'...
' FROM face_new.user_t ']);
fetched_data = fetch(curs);
DataReturnFormat can include 'numeric', 'cell', 'structure', 'table', and 'timetable' . However some database types only support a subset of those.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by