How can I create a table in Access with Matlab that allows for different names of columns and rows without being hard coded?
Show older comments
Hello,
So I'm making progress in my creation of a function that creates a table in Access from Matlab, but I'm trying to make it even more robust. What I mean by this is that, lets say I have an n by m (where n can be any number of rows and m can be any number of columns) cell (imported as data from excel and turn into said cell) and I want it to be able to pick up the first row and first column of this cell as the titles to the data the is inside the n by m cell. The row and column names can change so it has to be able to detect it from the cell, I just don't know how to do that or I am close but not doing it right.
Here's what I've got so far.
CreateTable = ['CREATE TABLE Item(Item ID varchar, '...
'Item Number varchar,Location varchar,Order int)'];
I also don't think this is complete because I believe this only does the first column of the data and misses the top first row with other indicators.
I'm think there has got to be a way to get it to where it would be something like:
['CREATE TABLE Item(data(1,1:end) varchar)'];
Where data is the n by m cell. Again, still working on how to grab the names given in the top row.
Is this possible?
Thank you,
L
2 Comments
L
on 16 Dec 2016
L
if you store the table in CSV format then both Excel and Access will open it and there you can display and process.
John BG
Accepted Answer
More Answers (1)
Why not starting from any of this links
- Export to Excel format, Access will open it anyway https://uk.mathworks.com/help/matlab/import_export/exporting-to-excel-spreadsheets.html?s_tid=srchtitle
- SQL, whatever https://uk.mathworks.com/matlabcentral/fileexchange/17897-access-a-mysql-database?s_tid=srchtitle
- Access also open Power Point Tables, an export to PPoint should work to Access https://uk.mathworks.com/matlabcentral/fileexchange/40277-exporttopptx?s_tid=srchtitle
- and the commandshttps://uk.mathworks.com/matlabcentral/fileexchange/15834-export-data-to-sas?s_tid=srchtitle
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help, please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG
Categories
Find more on Tables in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!