Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a MatLab code that I'll call "MatLab_Processing_Tool" that takes the path and filename from a file that list them out. I'll call that text file "ListFile". Right now in ListFile I have to comment out and in the filenames and paths (one at a time) to get the MatLab_Processing_Tool to run, but the problem I have is like 100 or more of these text files need to be run by passing them into it the path and filename and assigned by fnarr. I know how to create the ListFile, but can I somehow batch assigning them to fnarr?
I can't answer your question, because I don't know Matlab language. But that's my point. I think you are more likely to get an answer from a more specific forum, such as http://www.mathworks.co.uk/matlabcentral.
I don't think, but I could be wrong, that this is not a MatLab question at all. The only thing that MatLab cares about is what path and file is assigned to fnarr. So I jsut need a script that feeds MatLab a new fnarr every time it makes a call for one. Also I'm pretty sure that MatLab will take standard shell commands, maybe even awk
Yes we may be able to help but we need more clarification. Am I right in understanding that you have a file with a list of filenames, and you want to feed them one at a time to another program (MatLab_Processing_Tool in this case). By the look of it you are commenting out all but one file (using % as a comment directive) and feeding the resultant file to Matlab. The last line - is that a part of the file or is it a script run inside Matlab. Are you wanting to run this "MatLab_Processing_Tool" on each filename at a time? If so, wouldn't that need a Matlab script? I confess to being a bit lost.
Is there a way to invoke MatLab_Processing_Tool outside of Matlab just using the desired filename? (e.g. matlab -f filename.txt or something) so that you can build a script to extract one filename from the listfile at a time and feed it to Matlab. That shouldn't be too hard to do in bash. Otherwise there are tools to either comment out or delete unwanted names.
As far as I unuderstood, you want to pass all files one by one to MatLab_Processing_Tool( fnarr ).... Right?
Well, this could be achieved by using a simple shell script.
First, get a list of all files that you want to pass into the fnarr, as follow:
ls -la | awk -F" " '{print $8}' > /tmp/ListFiles.txt
Then create a simple script as:
#!/bin/sh
LIST="/tmp/ListFiles.txt"
for file in `cat $LIST`
do
MatLab_Processing_Tool( fnarr )
done
Make this script executable using chmod +x scriptname.sh and invoke using ./scriptname.sh
So try it out, and let's know if you still have any issue.
@meninvenus: how do you write inline code with mono font, as per your chmod example?
In advanced reply mode (not in quick reply), select the text you want to change font type, and then under fonts option, select courier or Fixedsys font. It will work. :-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.