필터 지우기
필터 지우기

How to import and export data through MATLAB?

조회 수: 3 (최근 30일)
L
L 2016년 11월 22일
댓글: Walter Roberson 2016년 11월 27일
Hello everyone,
Thank you in advance for your help. Normally I don't like to ask without providing what I've tried, but I'm trying to save time on what I'm trying to do.
What I am trying to achieve is a script that can automate the process of importing excel data into Matlab and then exporting it into an Access database. Basically a spreadsheet with some data and then storing it into Access by adding said spreadsheet as a new table in said database. My only real problem is that I'm not sure on the specific Matlab functions the import and export data.
I've read about several different ways to import data, but none of them I have come across give me specific functions to string together, instead it they refer to the buttons available in Matlab's "Home" tab.
Any ideas or hints in order for me to do this correctly with ease?
If I didn't provide enough of an explanation please let me know. I greatly appreciate any tips/advice you all have to offer.
EDIT: Also, I'm not just going to sit and wait for an answer, I'll be trying to string something together and then hopefully, with your inputs, I can compare to what I've done and share it with what anyone has recommended. Thank you.
Thank you,
L
  댓글 수: 1
L
L 2016년 11월 25일
편집: Walter Roberson 2016년 11월 26일
UPDATE: Still need help. First answer didn't really help.
Here is what I've got so far:
[data pathname] = uigetfile( ...
{'*.m;*.xls;*.xlt;*.xlm;*.xlsx*.fig;*.mat;*.mdl', 'Files (*.m, *.fig, *.mat, *.mdl)'; ...
'*.*', 'All Files (*.*)'}, ... 'Pick a file','C:\Users\');
stuff = importdata([pathname data]);
Previously I had xlsread instead of import data, but it wasn't grabbing the variable names (like row one has all the different names of the data, Day 1, Day 2 ,etc.). Also, the first column, column A, doesn't get pulled either (it is also full of text, John Smith, Alice Jane, etc.)
I switched to using the importdata function and that seems to work but it's output, "stuff" is a structure with two things inside. What I want is stuff to equal the data in the excel file I'm trying to pull (stuff equals the table of data, column names and row names AND data all in one).
Thank you,
L

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2016년 11월 23일
Check xlsread, xlswrite.
Also go through readtable and writetable.
  댓글 수: 7
L
L 2016년 11월 26일
You're awesome, thank you Walter! The "raw" part was what I wanted, at least I think. Then next step of my little goal is to then transfer the information contained in "raw" into a Microsoft Access database. I'm thinking I should be able to use some function with raw being used in it to save the data to a database. Got any pointers for that direction?
Again, thank you very much!
-L
Walter Roberson
Walter Roberson 2016년 11월 27일
Sorry, I have not worked with Microsoft Access.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by