필터 지우기
필터 지우기

Import File function not working?

조회 수: 40 (최근 30일)
xander fong
xander fong 2015년 7월 15일
답변: Ghada Saleh 2015년 7월 17일
Hello, I'm trying to create a script that sucks in Excel files, and keeps selected Data from one of its multiple spreadsheet tabs. However, the import file function is not working for me. Here is what I have:
%----------------------------------------------------------------% if ~exist('initialUpload.mat', 'file') dirName = '/Users/xanderfong/Documents/TestFiles' files = dir('*.xlsx'); %list all *.xyz files files = {files.name}'; % Transpose Names data = cell(numel(files),1); % Store File Contents for i=1:numel(files) % Load file into data data{i} = importfile(files{i},'Test-Spreadsheet'); end
MATLAb returns: "Undefined function 'importfile' for input arguments of type 'char'."
  댓글 수: 1
Stephen23
Stephen23 2015년 7월 15일
When I search the MATLAB documentation for "importfile" I get these four results:
But there is no function called importfile. Where did you hear about this function?

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

채택된 답변

Ghada Saleh
Ghada Saleh 2015년 7월 17일
Hi Xander,
I assume this is the function generated from the Import Data tool in MATLAB. One possible reason for this error is that you have another function shadowing this one. You can try the following command:
>> which -all importfile
This should return the paths of all functions with the name 'importfile' in MATLAB search path. If there is another function in MATLAB search path, remove it from the path and try again.
If this does not work or if you see a single output corresponding to your 'importfile' function, upload your 'importfile' function and the Excel data file so we can check what is causing the error.
I hope this helps,
Ghada

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by