Clear Filters
Clear Filters

ls command on a Mac doesn't work

5 views (last 30 days)
Deja C
Deja C on 8 Dec 2021
Edited: Shubham on 30 Apr 2024
ls works if I use it in the command window in MATLAB R2021b and in the Mac terminal, but it doesn't work in a live script.
When running a code in the editor window in MATLAB, I always get an error stating that the file is invalid or not found in the directory. I need my code to read a list of files in the directory to go through a loop.
I apologize in advance. I'm not the most fluent in computer science.

Answers (1)

Shubham
Shubham on 30 Apr 2024
Edited: Shubham on 30 Apr 2024
Hey Deja,
In MATLAB, the ls command works similarly to how it does in UNIX-based systems (like Mac's terminal) for listing directory contents. However, when you're working in a MATLAB Live Script or the MATLAB editor and you encounter issues with ls not functioning as expected, it's often due to differences in how the environment handles current directories or path issues.
You may find the below resources useful:
I hope this helps!

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!