"No such file or directory" when executing Perl script - iphone

I have a 3D modal for cup.obj. I need to convert to .h file so I downloaded this http://heikobehrens.net/2009/08/27/obj2opengl/ And put cup.obj file to this folder. Then I run from terminal obj2opengl.pl cup.obj I didn't get .h file.
Ranganatha-GVs-Mac-mini:~ ranganathagv$ ./obj2opengl.pl cup.obj
-bash: ./obj2opengl.pl: No such file or directory
Ranganatha-GVs-Mac-mini:~ ranganathagv$

The obj2opengl.pl script probably hasn't the right permission set in order to be executable using the ./ syntax.
Two choices here, you can either:
Change the permission on the script using chmod +x obj2opengl.pl, and using ./obj2opengl.pl cup.obj should work from there on, or
Run the script using perl obj2opengl.pl cup.obj.
Hope this helps!

Related

7-zip extracted files not showing up when called from command line

I am attempting to write a command that calls 7-zip from the command line. My command is:
7z x z:\dev\archive.7z
Anytime I run this command in the command prompt, it acts like it's working, but when I navigate to the folder after the fact, the extracted files aren't there, although they are there if I run 7-zip from the contextual menu. Is there something I'm missing here?
If you don't specify a destination directory, 7z will extract files in your current directory.
As per the doc, to specify a target:
7z x archive.zip -oC:\path\to\target
Or use cd C:\path\to\target and then invoke your initial command.
In your case (from comments), what you want is:
7z x z:\dev\archive.7z -oz:\dev
This nice answer might help if you're confused with the options.
Try using the -spf switch
7z x z:\dev\archive.7z -spf

Is it possible to set output directory for triangle program from triangle package?

I see no way to set destination directory or file here: http://www.cs.cmu.edu/~quake/triangle.switch.html
Actually, the program places result file in the same directory, even if current directory is different.
Why? Is ti possible to change?
The output files for the program are generated from the input file names. You can see this from the source code on line 3586
strcpy(b->outnodefilename, b->innodefilename);
...
strcat(b->outnodefilename, ".node");
strcat(b->outelefilename, ".ele");
...
Because of that I don't think there is a way to set the output directory as an option. It seems you will need to manually copy the output files to a different directory
cp output.node your/output/dir/output.node && rm output.node

Why do I get an error with fopen when using matlab's mcc?

Setup:
Windows 7 Enterprise.
Matlab 7.10.0 (R2010a).
mcc compiler: Microsoft Visual C++ 2008 Express.
What's happening:
My project runs fine when running it through Matlab, but when trying to run the .exe through the command prompt after using mcc to compile, the command prompt generates an error.
The mcc command I issue is:
mcc -m -v STARTUP1.m -o EXE_REDUC
The error I receive in the command prompt is:
??? Error using ==> textscan
Invalid file identifier. Use fopen to generate a valid file identifier.
I have a file called LoadXLS.m that loads and reads a .csv file using:
fid = fopen(file,'r');
temp_data = textscan(fid,...args...);
And then I process temp_data.
The csv file I'm trying to load is called spec.csv. It is located two directories down from where I have STARTUP1.m stored. The location of STARTUP1.m is also the place that the mcc generated files are stored to. I have used the pathtool to "Add with subfolders" this location, but am aware that those locations are not transferred to mbuild when compiling.
What I've Tried:
I have gone in and added print statements to print the value of fid to make sure it is valid. When I run it in Matlab, it has a valid value, however when I run in the command prompt it always returns an invalid value of -1.
I have removed all addpath() calls, I have tried adding the STARTUP1.m directory to the mcc ctf archive using:
mcc -m -v -a 'C:\Users\...path...\STARTUP1.m_location' STARTUP1.m -o EXE_REDUC;
However when I do this, I get a different error when running in the command prompt:
Cannot open CTF archive file
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296'
or
'C:\...path...\AppData\Local\Temp\mathworks_tmp_7532_28296.zip'
??? Undefined function or variable 'matlabrc'.
To fix this, I've tried adding the pragma
%#function matlabrc
to the top of STARTUP1.m to try and enforce its inclusion, but had no success.
I also copied the spec.csv file to a new directory in the ctfroot and changed
fid = fopen(...)
to:
[tempFile, message] = fopen(fullfile(ctfroot, 'Added Config Files', ad.spec_file));
The message is:
message is: No such file or directory
Objective:
Rearranging file locations is a sufficient workaround while the exectuable only runs on my computer, however the idea is to take this standalone and distribute it to multiple people on many different computers. I would like to be able to have a top folder with a startup file and within this folder, have as many subfolders as the package requires. The startup file should be able to access all subfolders and files within them as necessary.
I read something about the exectuable actually running from a "secret location" on the machine here: http://matlab.wikia.com/wiki/FAQ
I would just like to be able to group one entire folder tree with all its files into a package containing the executable and be able to run it anywhere.
More info:
When I put the spec.csv file in the same directory as STARUTP1.m, it finds it fine using mcc without the -a 'path' option and using the following in the LoadXLS.m file:
[tempFile, message] = fopen(ad.spec_file,'r');
This project contains GUIs, generates PDFs, generates plots, and also creates a zip directory.
Thank you in advance.

Matlab function call directory

So i had this issue that occurred when I ran a Matlab script. Here is an a simple example that illustrates it:
So its important to outline the file structure:
MainFolder
script.m
SubFolder
a1.csv
a2.csv
a3.csv
now say i have a script like this:
-> script.m
dir
it would simply print out the files in the folder.
Now the wierd thing, if i run the script in the Subfolder like this:
>>script
it will do this:
>> a1.csv a2.csv a3.csv
but if i do this in the folder:
>>run('C:\Users\....\MainFolder\script.m')
it will only print out
>> script.m
So obviously it is acting as if i ran it form MainFolder rather than SubFolder.
What is the point of this functionality?
The dir command shows the directory contents of Matlab's current directory, not that of where the script is located. So the script showed you the directory contents of wherever you happened to be in the Matlab command prompt when you called that script.
To get what you want, use this in the script:
dir(fileparts(mfilename('fullpath')))
Use pwd to see current dir
Use cd to change directory
Use path to see if your project folders are included in the path
Use which to see you are calling the right *.m file (in case there is multiple .m files with same name on the path)

Can't exec No such file or directory

Merry Christmas to everybody. I'm having a dilemma with a perl script. In my script, I call another program with a system call, but I got this error:
Can't exec "./Classificador/svm_classify": No such file or directory at Analise_de_Sentimentos_mudanca.pl line 463.
I don't know if there is a problem in having my program in a different directory than the called program.
Another curious thing is that this script used to run normally in Ubuntu 10.10. But now I've changed to Mint 14. Is it missing some library?
Best wishes,
Thiago
The relative pathname ./Classificador/svm_classify is interpreted relative to the user's current directory, not the directory containing the perl script. You need to do one of the following:
The user must cd to the directory containing the perl script before running it.
The perl script should call chdir() to set the current directory to the directory where it's stored.
Put the absolute pathname in the script, instead of ./.
Does this "./Classificador/svm_classify" exists ?
Check the following :
1) to go the directory where this file lays - Analise_de_Sentimentos_mudanca.pl
2) run :
ll Classificador/svm_classify
3) show us the results