MATLAB DATABASE TOOLBOX RELEASE NOTES Podręcznik Użytkownika Strona 596

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 684
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 595
7 Functions — Alphabetical List
7-166
stockNumber
supplierNumber
unitCost
productDescription
conn = database.ODBCConnection('dbtoolboxdemo','admin','admin');
Select and display the data from the productTable table.
curs = exec(conn,'select * from productTable');
curs = fetch(curs);
curs.Data
ans =
productNumber stockNumber supplierNumber unitCost productDescription
------------- ----------- -------------- -------- ------------------
9 125970 1003 13 'Victorian Doll'
8 212569 1001 5 'Train Set'
7 389123 1007 16 'Engine Kit'
2 400314 1002 9 'Painting Set'
4 400339 1008 21 'Space Cruiser'
1 400345 1001 14 'Building Blocks'
5 400455 1005 3 'Tin Soldier'
6 400876 1004 8 'Sail Boat'
3 400999 1009 17 'Slinky'
10 888652 1006 24 'Teddy Bear'
Store the column names of productTable in a cell array.
colnames = {'productNumber','stockNumber','supplierNumber',...
'unitCost','productDescription'};
Store the data for the insert in the cell array data that contains these values:
productNumber equal to 11
stockNumber equal to 400565
supplierNumber equal to 1010
unitCost equal to $10
productDescription equal to 'Rubik''s Cube'
Then, convert the cell array to the table data_table.
data = {11,400565,1010,10,'Rubik''s Cube'};
data_table = cell2table(data,'VariableNames',colnames)
Przeglądanie stron 595
1 2 ... 591 592 593 594 595 596 597 598 599 600 601 ... 683 684

Komentarze do niniejszej Instrukcji

Brak uwag