필터 지우기
필터 지우기

Loop for repeated file input if error

조회 수: 3 (최근 30일)
Pallav Patel
Pallav Patel 2020년 3월 15일
댓글: Walter Roberson 2020년 3월 15일
clc
clear
close all
%Input for data file name
myFilename = input('Please enter data file name.(Case sensitive):''s');
myFilename1 = 'myFilename';
%While loop if datafile does not exist
while <filenamedoesnotexist>
myFilename = input('Please enter the correct data file name(Case sensitive). Ensure spelling is correct:');
myFilename1 = 'myFilename';
end
%Import data from excel file
[times,Company_name,~] = xlsread(myFilename1)
I want Matlab to create a while loop if the file name entered brings in an error like file does not exist until user writes correct file name.
  댓글 수: 8
Pallav Patel
Pallav Patel 2020년 3월 15일
Wow thank you. That works perfectly. Is file a function?
Walter Roberson
Walter Roberson 2020년 3월 15일

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

답변 (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