matlab cannot find the datainsert function

1 visualización (últimos 30 días)
James Johnson
James Johnson el 18 de En. de 2018
Editada: James Johnson el 27 de En. de 2018
I confirmed that I have Matlab's Database Toolbox. I also reinstalled the latest matlab R2017b because it didn't work with 2017a. It looks like Matlab might have a pretty serious bug, or maybe I'm doing something wrong. This is my first time trying. Here is what I do and the errors I get:
>> help datainsert
datainsert not found.
Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods.
That's already weird then I do:
>> conn=sqlite('test.db','create')
conn =
sqlite with properties:
Database: 'test.db'
IsOpen: 1
IsReadOnly: 0
>> exec(conn,'create table TestTable (IDtest NUMERIC, data_test NUMERIC)')
>> datainsert(conn,'TestTable','IDtest',1)
Undefined function or variable 'datainsert'.
Just so you can see that I have everything installed here is the output of my ver command:
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.3.0.713579 (R2017b)
MATLAB License Number: XXXXX
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 16299)
Java Version: Java 1.8.0_121-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.3 (R2017b)
Simulink Version 9.0 (R2017b)
Bioinformatics Toolbox Version 4.9 (R2017b)
Communications System Toolbox Version 6.5 (R2017b)
Computer Vision System Toolbox Version 8.0 (R2017b)
Control System Toolbox Version 10.3 (R2017b)
Curve Fitting Toolbox Version 3.5.6 (R2017b)
DSP System Toolbox Version 9.5 (R2017b)
Data Acquisition Toolbox Version 3.12 (R2017b)
Database Toolbox Version 8.0 (R2017b)
FYI datainsert is a built-in (not user-defined) function: https://www.mathworks.com/help/database/ug/datainsert.html

Respuesta aceptada

James Johnson
James Johnson el 18 de En. de 2018
2 relevant details came up when Mathworks resolved the issue.
1) datainsert is not on the path until the user calls the "database function: so the following code gets it to appear:
>>database;
>> help datainsert
--- help for database.jdbc.connection/datainsert ---
datainsert Export MATLAB data into database table.
2) Mathworks changed the folder where the functions are stored. In the 2015b installation I have on one computer they are in: C:\Program Files\MATLAB\R2015b\toolbox\database\database\
now they are in:
C:\Program Files\MATLAB\R2017b\toolbox\database\database\+database\+jdbc\@connection
  1 comentario
Arthur Goldsipe
Arthur Goldsipe el 18 de En. de 2018
I'd like to clarify some details and answer the question in your comment on my proposed answer.
As you discovered, the implementation of datainsert changed between R2015b and R2017b. It was a standalone function in R2015b, but it's now an object method in R2017b. Many times, those details don't matter. But the help method is a case where this difference matters.
The help command only looks for methods for objects you've actually used in this MATLAB session. Before you create a database object, help datainsert returns nothing. After you create a database object, help datainsert returns the information you're looking for. Nothing gets downloaded to make this happen. It's just that the help system gets the hint it needs to figure out where to look for the datainsert help.
However, you can always access the datainsert help by fully specifying that it's a method of the database object: help database.jdbc.connection/datainsert. However, I usually just search for help using the doc command, which does not suffer from this limitation. If you type doc datainsert, you should find the information you're looking for.

Iniciar sesión para comentar.

Más respuestas (1)

Arthur Goldsipe
Arthur Goldsipe el 18 de En. de 2018
Hi,
I think you need to use insert instead of datainsert. The Database Toolbox offers two different ways of working with sqlite databases. insert is the command to use when the connection is created using sqlite; datainsert is the command to use when the connection is created using database. You can read more about the two different approaches here .
  1 comentario
James Johnson
James Johnson el 18 de En. de 2018
Editada: James Johnson el 27 de En. de 2018
Thanks, that may offer a path forward for today. Is the fact that the datainsert function is missing a separate issue or is it related? For example, does matlab refrain from downloading datainsert until a person creates a database using the "database" function?

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by