How do I read a file name into a function?
이전 댓글 표시
I have a folder full of .stl files containing sets of (x,y,z) co-ordinates of points in 3d. I have found a function, stlread, which reads these files, all I have to do is call the path of the file in ' ' quotation marks.
How do I choose this file from a directory and put it into stlread? If I use the MATLAB function filename=uigetfile, I can choose the file but if I use stlread(filename) it doesn't work even though filename is a string.
Eventually I wish to possibly have a list of paths to .stl files in a .txt file and then extract each one in turn to run stlread on all of them. Is this possible somehow?
댓글 수: 1
Sara
2014년 8월 4일
Look into dir(directory_name). This will give you the list of all the files in a specific directory. You can then run your code on all the stl files with a loop.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!