You can access your Icloud drive from the terminal through this command:
$ cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/
Then, in your MATLAB folder (or in any other folder in your machine) you can create a virtual link to that folder. Then your data will be in ICloud, and accessible by MATLAB at the same time. In my case, my MATLAB folder is inside the Documents one, so you can create the link with this command (also from the terminal):
$ ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs/ ~/Documents/MATLAB/my_icloud
In this way you will have a new folder called my_icloud which is not more than a link to your Icloud drive folder. The tilde (~) is a Unix-like character that symbolizes your HOME folder.