How do I check if a file on a website exists?
Mostra commenti meno recenti
I want to read in image files from my online database.
I would like to check my website to see if the file exists before attempting to load it into the workspace.
For Example I would like to do (simplified):
E = exist('http://www.mywebsite.com/images/1.png);
if E ~= 0
IMG = imread('http://www.mywebsite.com/images/1.png);
else
IMG = zeros(X,Y);
end
Thanks in Advance!
Risposta accettata
Più risposte (1)
Erick Oberstar
il 15 Dic 2015
you can use urlread also
[str,status] = urlread('http://www.mywebsite.com/images/1.png');
if status
IMG = imread('http://www.mywebsite.com/images/1.png');
else
disp('URL read of link was unsuccessful')
end
1 Commento
Ali Abed
il 15 Ott 2017
thank you
Categorie
Scopri di più su MATLAB Compiler in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!