Azzera filtri
Azzera filtri

Loop for repeated file input if error

3 visualizzazioni (ultimi 30 giorni)
Pallav Patel
Pallav Patel il 15 Mar 2020
Commentato: Walter Roberson il 15 Mar 2020
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 Commenti
Pallav Patel
Pallav Patel il 15 Mar 2020
Wow thank you. That works perfectly. Is file a function?

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by