Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
How do I create a control loop to run images from a folder through code?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a folder that have these images, with these names:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168643/image.png)
I would like to run these images through this segment of code:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168645/image.png)
The segment that says A= imread('....') is where i'd like to to automatically feed the images from the previous pictures, rather than manually changing the file name each time I have to run an image.
I know I have to set up a control loop, but I don't know how to institute it.
Thanks in advance.
0 Commenti
Risposte (1)
Cam Salzberger
il 23 Ott 2017
Hello Tushar,
You can use dir to get information about the contents of a folder. Loop through each element of the resulting struct array for your loop size. Use the "isdir" field to ignore anything that isn't a file, and the "name" field to get the filename (and check the extension if you want). You can append it to the "folder" field to get an absolute path to the file, which you can feed to "imread".
-Cam
0 Commenti
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!