필터 지우기
필터 지우기

xlsread error, wont open file

조회 수: 7 (최근 30일)
Anthony Voccia
Anthony Voccia 2018년 11월 15일
댓글: Star Strider 2018년 11월 15일
Error using xlsread (line 139)
XLSREAD unable to open file 'Prelab'.
File 'Prelab' not found.
Error in Prelab (line 5)
A1 = xlsread('Prelab',1,'A2:A16');
I have used this method a few times now but it is not working for this file, any ideas?
clc, clear, close all;
path = 'C:\Users\Anthony\Desktop\220 Lab' ;
filename = 'Prelab.xlsx' ;
fullpath = [path, '\', filename];
A1 = xlsread('Prelab',1,'A2:A16');
B1 = xlsread('Prelab',1,'B2:B16')*10^-3;
plot(A1,B1);
xlabel('load (gr-Kg-lbs');
ylabel('Deflection (in)');
title('Load (gr) vs. Deflection (in)');
  댓글 수: 2
Anthony Voccia
Anthony Voccia 2018년 11월 15일
I figured it out, I was using a combination of two different methods. This is what it should have been
A1 = xlsread(fullpath,'A2:A16');
Star Strider
Star Strider 2018년 11월 15일
If I remember correctly, that was essentially the solution I gave in my my Answer.

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

답변 (3개)

Star Strider
Star Strider 2018년 11월 15일
A guess:
A1 = xlsread(fullpath,1,'A2:A16');
B1 = xlsread(fullpath,1,'B2:B16')*1E-3;

madhan ravi
madhan ravi 2018년 11월 15일
Make sure Prelab excel file is there in the path as the error message clearly states that there is no such file
  댓글 수: 1
Anthony Voccia
Anthony Voccia 2018년 11월 15일
That is why I am confused because the file is there. I use the same file to store the other excel documents and they work fine

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


Luna
Luna 2018년 11월 15일
편집: Luna 2018년 11월 15일
Hello Anthony
check the inputs of xlsread function.
First input should be the full file name with path or if your matlab‘s current path is the same directory that contains your excel, the first input can be the file name with its extension.
For example:
xlsread(C:\Users\Desktop\myExcel.xls,.. etc)
xlsread(myExcel.xls,etc)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by