Executing Matlab files
In my LabView program, I want to execute a Matlab scrtipt. Part of the Matlab script loads another file. The error I get in LabView is 1050 ('Cannot open file'). The file is saved in the same directory as the LabView program file. What is the problem?
After reading some other discussions, I found the problem. In case anyone was wondering, the matlab directory needed to be changed to the labView directory.
Similar Messages
-
Executing batch file from Java stored procedure hang
Dears,
I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
public static String runFile(String drive)
String result = "";
String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
try {
File directory = new File(drive + ":");
File file = File.createTempFile("bb1", ".bat", directory);
file.deleteOnExit();
FileWriter fw = new java.io.FileWriter(file);
fw.write(content);
fw.close();
// The next line is the command causing the problem
Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
while ((line = input.readLine()) != null)
result += line;
input.close();
file.delete();
result = result.substring( result.lastIndexOf( ' ' )).trim();
} catch (Exception e) {
e.printStackTrace();
result = e.getClass().getName() + " : " + e.getMessage();
return result;
The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
I gave the SYSTEM schema the required privilege to execute the code.
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
GRANT JAVAUSERPRIV TO SYSTEM;
I have used the following to load the class in Oracle 9ir2 DB:
loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
I have seen similar problems on other forums, but no solution posted
[http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
Can anyne help?Dear Peter,
You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
where content of bb1.bat as follows:
echo off
vol C: | find /i "Serial Number is"
The above batch file just get the serial number of hard drive assigned when windows formatted HD.
Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
variable serial1 varchar2(1000);
call A1( 'C' ) into :serial1;
Never returns
Thanks for tracing teh issue to that details ;) hope you coul help. -
Reg : Executing .exe file from application server
Dear Experts,
i have a requirement to execute an .exe file from application server,i tried with method CL_GUI_FRONTEND_SERVICES=>EXECUTE but it executes .exe file from presentation server only.can
anyone kindly clarify to execute .exe file from application server?
Thanks in advance,
SujayHi,
Did you search before posting?
Re: Execute a .exe file present in the Application Server
Vikranth -
Security restriction while executing Flash file
Hi,
I am a beginer with Flash and I developed some sample Flash
files(swf) using Flash MX 2004. The files were able to run with IE
with out any issue on my XP machine which is having IE 6. The same
files when I tried with IE 7 on Windows Vista, it is not letting me
to run initially. It says ".... IE has restricted this web page
from running scripts or Activex controlls that could access your
computer....". Though I can right click and click 'Allow Blocked
Content' to execute the file, I am wondering whether I can do some
setting on the file itself to make it trusted or something like
that. I can also change the IE settings not to restrict the file.
But I think it won't be a general solution.
I wanted embedd this flah file on an html page and I want to
make sure that the file will execute with out the security warning
or change in the IE settings.
Most of the internet sites that I used access has flash
content and my IE does not used to show any warning. How can I
achieve the same with my flash file?
Thanks in advance
SebIf you embed the swf in the HTML it will not display that
warning. The warning is something that IE displays when you open
the SWF directly. -
Remote Execute and File Transfer Error
Whenever we try to do a Remote Execute of File Transfer, we get an 1899
error. Here's the strange thing, we can RE and FT to desktops that are
still running the ZfD 4.x client. Seems to be only happening on the latest
(ZfD 6.5sp2). Any ideas? Also, remote control and remote view still work
w/o problem.Blewis,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
- Check all of the other support tools and options available at
http://support.novell.com.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://support.novell.com/forums)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://support.novell.com/forums/faq_general.html
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Product Support Forums Team
http://support.novell.com/forums/ -
I wish to convert my Matlab files into .dll's so that I can use them in LabVIEW. I am using 'mcc' and 'mbuild' of Matlab to convert my .m files into .c and .dll.
When I try to run the .dll's in LabVIEW, I get an error message in a modal window stating some required .dll or procedure is not found.
How should I resolve this issue. Should I add any other Matlab .dll's in course of making my .dll?
Please help in solving this issue... Thankyou very much.KJV wrote in message news:<[email protected]>...
> When I run the matlab generated dll, it is stating 'matllb.dll not
> found'. Is it that I should set the path for matlab\bin to include
> all the dll's before I compile? When I make dll from C, it works fine
> in LabVIEW. The problem is from .m to .dll. The problem also arises
> when I convert my .m to .exe. The same error of 'matllb.dll not
> found' comes over. Should I change my matlab compiler options or
> something else? Please help me?
I have the same question,I don't know how to use the matlab DLL file in labview,
I hope someone can descripe the procedure in detail. -
So, I search the binary matlab file format('*.mat').
Title:
Moving Data Between MATLAB® and LabVIEW
Problem:
How can I share data between LabVIEW and the MATLAB environment?
Solution:
MATLAB users can move data between the
MATLAB environment and LabVIEW, you have several options. Prior to
LabVIEW 5.1, the only way to transfer data between these two
environments was to use the Save and Load functions. Those are discussed herein.
Beginning
in LabVIEW 8.0, MathScipt was introduced. MathScript is an integrated
part of LabVIEW that you can use to combine intuitive graphical
dataflow programming with math-oriented textual programming. See the
attached links below for more information on MathScript.
Beginning
in LabVIEW 5.1, the MATLAB script node was introduced into the LabVIEW
programming environment. The MATLAB script node makes ActiveX calls to
the MATLAB software from within LabVIEW. This requires that both MATLAB
be installed on the same machine and that a valid license is obtained.
More information on the MATLAB script node can be found in the attached
KB's.
For all versions of LabVIEW, this data transfer can be
performed by saving the data in a file using the MATLAB software and
reading it directly from LabVIEW, or vice versa. In the MATLAB
environment, the command "save" allows you to save the data in
binary format (*.mat) or ASCII format. You also have an option of
saving it in ASCII format using a tab delimiter between data points and
the command "load" allows you to read in the data.
ASCII Format
Complete the following steps to import or export data between LabVIEW and the MATLAB environment using an ASCII file format.
From the MATLAB environment to LabVIEW
To save a vector or a matrix X in tab-delimited ASCII format, enter the following in the command window or m-script file in the MATLAB environment:
>>SAVE filename X -ascii -double -tabs
This creates a file named filename containing data X in tab-delimited ASCII format.
Import the file into LabVIEW using the Read From Spreadsheet File VI located on the Functions»File I/O palette.
From LabVIEW to the MATLAB environment
To export a matrix X from LabVIEW to the MATLAB environment, first save the data in ASCII format in LabVIEW using the Write To Spreadsheet File VI on the Functions » File I/O palette.
Enter the following in the command window of the MATLAB environment, or in the m-script file:
>> LOAD filename
This reads the data into the MATLAB environment.
Binary Format
Complete the following steps to import or export data between LabVIEW and the MATLAB environment.
From the MATLAB environment to LabVIEW
As mentioned above, LabVIEW does not save multiple variables to one
data with extra manipulation, and will not be discussed here.
Therefore, the only way of sending the data from the MATLAB environment
to LabVIEW without tampering with the MAT binary file structure is
using the ASCII format. Also, please bear in mind that you need to have
one file for one variable.
From LabVIEW to the MATLAB environment
Because
the MATLAB software saves data in its own binary format, the "MAT"
file, binary LabVIEW data must be converted to this format prior to
transferring the data. The attached examples can be used to save
LabVIEW data in the MATLAB software format. The convenience of the .MAT
file format is that more than one variable can be saved in the same
file. The example shows saving seven variables to .MAT format; the
example can be modified for any number of variables.
Once this data is saved from LabVIEW, it can be read into the MATLAB environment, using the following command:
>>LOAD filename
The Who
command can then be used to display all the seven variable names, and
you can display the content of them by entering the variable names at
the command prompt as usual.
MATLAB® is a
registered trademark of The MathWorks, Inc. Other product and company
names listed are trademarks and trade names of their respective
companies.
| Michael K | Project Manager | LabVIEW R&D | National Instruments | -
Oracle error while executing VBscript file
I have a Connection.vbs file with following contents:
Dim strCon
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST= TRISHUL)(PORT=1525))" & _
"(CONNECT_DATA=(SERVICE_NAME=BTFLVAS))); uid=odb;pwd=odb;"
Dim ocon1:set ocon1=CreateObject("ADODB.Connection")
ocon1.open strCon
Getting this error as a pop up message while executing this file :
Script: D:\Connection.vbs
Line: 10
Char: 1
Error: [Microsoft][ODBC driver for Oracle][Oracle]
Code: 80004005
Source: Microsoft OLE DB Provider for ODBC Drivers
Please help!
ShrutiYou are using an ODBC driver to connect to Oracle. The error you get is not an Oracle server error. (so ignore the silly request for an alert log)
The error is from your client Oracle driver. It gets a TNS connection string (or alias) from the ODBC driver. This tells it how to establish a network connection to the Oracle Listener on the Oracle server platform.
The Oracle driver then runs into a problem and says:
12560, 00000, "TNS:protocol adapter error"
// *Cause: A generic protocol adapter error occurred.
// *Action: Check addresses used for proper protocol specification. Before
// reporting this error, look at the error stack and check for lower level
// transport errors. For further details, turn on tracing and reexecute the
// operation. Turn off tracing when the operation is complete.
Basic terms - your Oracle client driver ran into a network error when attempting to make the requested connection.
This could be caused by a number of problems on your PC. Suggest you first check your TNS connection string to make sure it is valid. You can use tnsping (Oracle util in %ORACLE_HOME%\bin), e.g.
C:\> tnsping "DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= TRISHUL)(PORT=1525))(CONNECT_DATA=(SERVICE_NAME=BTFLVAS)))"
See if this works. -
hi there,
I have a problem when a I execute JSP files. This is the message that I encounter everytime I executing JSP files:
" Java System Application Server Execution Note: make sure that the j2ee module or application has been deployed before using execution."
It seems that Application Server can not be started and I don't khow what I must do.
Best Regards.
Zolfagharhi friend
u just restart the application or deploy again on server.
i hope u won't get any error.
[email protected] -
Class not found error while executing jar file
I have written a java code in which i am connecting to database....when i run the class file using......java class_filename it works........
but when i run the jar file using .......java -jar jar_name ...yi gives me the error as 'Class not found'......
can anybody help me please......
Thanks and Regards,
Siddheshthat class is part of jar file.....in classpath i have included zip files for jdbc ...to get databse connection.....and the jar being executed ................still it gives the error ClassDefnotfound which i think is due to database connection problem.....the exception is raised while.....
Class.ForName("Driver_name").newInstance();/ This driver is present in zip files that i have added in classpath....
above statement doesn,t giv error while i execute the class file............but exception while executing jar file only..
Thnaks and regards,
siddhesh -
Why -jar option used to install a software which is in executable jar file?
Hi all,
i have a query, i have a generic installer which is used to install the oracle weblogic 10.3 software in unix platform(i.e., which is in .jar extension) which is executable jar file.
To install this software which have to use -jar option to install
java -jar net_server<version>_generic.jar
my question that why we use -jar option to install or to extract the software
can any one clarify my doubt...
thanks in advance
abhi
Edited by: sumanth_abhi on Jan 27, 2009 11:50 PMAccording to the Jar Guide (http://java.sun.com/j2se/1.4.2/docs/guide/jar/jarGuide.html)
Executable Jar Files
On Microsoft Windows systems, the Java 2 Runtime Environment's installation program will register a default association for Jar files so that double-clicking a Jar file on the desktop will automatically run it with javaw -jar. Dependent extensions bundled with the application will also be loaded automatically. This feature makes the end-user runtime environment easier to use on Microsoft Windows systems.
The Solaris 2.6 kernel has already been extended to recognize the special "magic" number that identifies a Jar file, and to invoke java -jar on such a Jar file as if it were a native Solaris executable. A application packaged in a Jar file can thus be executed directly from the command line or by clicking an icon on the CDE desktop.
Despite that every JAR file can be executed as a program if and only if the META-INF/Manifest.mf contains the Main-Class tag. This done through java -jar jarfile.jar
--olaf -
Executable JAR file: Could not find the main class.
Hello,
I have a problem with making an executable JAR file.
I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.
If I try:
jar cmf MainClass.txt User.jar User.class Beheerder.class Operator.class Manager.class MaakVisueelSchema.class
it makes a executable jar file which actually works! :)
But when the Operator class trys to open the MaakVisueelSchema class the screen stays blank.
I can run MaakVisueelSchema with java MaakVisueelSchema.
So I tried to make an executable JAR that consists only of MaakVisueelSchema, the same way as I did for User:
Main-Class: MaakVisueelSchema
jar cmf MainClass.txt MaakVisueelSchema.jar MaakVisueelSchema.class
Then I get the error message:
Could not find the main class. Program will exit.
from the Java Virtual Machine Launcher.
The big difference between MaakVisueelSchema and the other classes is that MaakVisueelSchema contains a PaintComponent method and an ComponentListener. Is it possible that one of those creates the error?
Can anyone help me with this problem?
Thanks in advance!
Bye!Yes,
I tried:
jar xvf MaakVisueelSchema.jar
and it returns:
META-INF/
META-INF/MANIFEST.MF
MaakVisueelSchema.classN/G. You need to manually create a manifest file in a text editor, have it point to your main class, and enter it in your jar command as an argument. -
Error executing batch file within web application
Hi all,
I am trying to execute a batch file from within my web application (struts 1.2).
The batch file is being kept inside the 'src' folder. The batch file contains only one command to open NOTEPAD.
The code inside my Action class is:
URL url = getClass().getResource("/test.bat");
java.io.File file = new java.io.File(url.getPath()) ;
String path = file.getCanonicalPath();
r.exec(path);
I have deployed this on tomcat and get an error like this:
java.io.IOException: Cannot run program "C:\Program%20Files\Apache%20Software%20Foundation\Tomcat%206.0\webapps\CIGTAFAPP\WEB-INF\classes\test.bat": CreateProcess error=2, The system cannot find the file specified
The problem is not with the batch file because when I try to execute the file directly from the classes folder, it opens up the notepad editor.
I have a specific requirement where I need to create/read this batch file from within the project structure.
Can someone please help me with this?
RegardsThe entire content of the file is as below:
set javaTestProjectPath=D:\projects\CIGTAF\LRTestCases
C:
cd %javaTestProjectPath%
set path=C:\Program Files\Java\jdk1.6.0_21\bin
set classpath=%javaTestProjectPath%\bin;%javaTestProjectPath%\lib\selenium-server-standalone-2.20.0.jar;%javaTestProjectPath%\lib\testng-6.4.jar;%javaTestProjectPath%\lib\junit-4.10.jar;%javaTestProjectPath%\lib\poi-3.6-20091214.jar;%javaTestProjectPath%\lib\mail.jar
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\Mailsetup.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\MailAuthenticator.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadData.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\ReadWriteExcelResults.java -d %javaTestProjectPath%\bin
javac -verbose %javaTestProjectPath%\src\com\core\testscripts\SeleniumFramework.java -d %javaTestProjectPath%\bin
java org.testng.TestNG %javaTestProjectPath%\SelXD-Config.xml -d %javaTestProjectPath%\test-output
none of these are getting executed.
regards
Edited by: 887789 on May 4, 2012 1:46 AM -
How can I add image files to a executable jar file ?
Could you tell me how can I add image files to executable jar file ?
package structure:
../com/Main.class
../images/..Please don't cross post, and read this
http://forum.java.sun.com/thread.jsp?forum=31&thread=271751
I've answered the question in the New To Java thread. -
How to execute .sql file in Stored Procedure?
Hi,
I have an urgent requirement, where i have to execute .sql file form Stored Procedure.
This .sql file will have set of update statement. I need to pass value to this update statement.
Kindly please help me.
Regards,
IrfanThis is required as part of Data Migration where i have to do 100 of table's update. Each time update table will defer, so its better to have in separate script file (.sql). Can u paste some sample/syntax to exceute .sql file from stored procedure. I am new to this PL/SQL.
How have you determined that it's "better" to have seperate scripts? I assume you mean the table name will "differ" (and not "defer" - I assume that's just because English isn't your first language? no problem - I think I understand what you're asking).
So what I think you're asking is that you have dynamic table names but each table needs to be updated in the same way?
Question: Why do you have tables with different names that all need the same process doing to them?
Assuming it's a valid requirement (and 99% of the time doing dynamic coding implies it's not).... you could use dynamic code, rather than 'scripts'...
e.g.
create procedure update_table(tbl_name varchar2) is
begin
execute immediate 'update '||tbl_name||' set lastupdate = null';
end;
As you haven't bothered to provide a database version, any example code/data or explanation of what you're actually doing, you're not going to get any detailed answer. Please do take the time to read the FAQ and post appropriate details so people can help you.
Maybe you are looking for
-
Shoulda thought of this before I built my site...
I've built this lovely Flash site that shows information on our company's projects by loading a .swf file into the main index page each time that project info is requested by a button click. There are not separate html pages for each .swf file to dis
-
Error message: MS word experienced a serious problem with the pdf create 8 word addin (nuance pdf product addin). if you have seen this message multiple times. you should disable this addin and check to see if an update is available. do you want to d
-
Hi +"CANON" has invalid directory structure ..+ I'm working on FCP 6.0 and I get that message during Log and Transfer. The CANON directory is on the camera CANON HF100. I have two iMac 5.1 with FCP 6.0 on the other iMac there is no problem. Plug in t
-
Error when increasing tempdb size UCCE 7.5
I am receiving the following error when attempting to increase the size of the Tempdb on our Historical Data Server. Expanding database tempdb Creating database device tempdbD112121455 for TempDb SQL Msg: (102 0r 0x66) Incorrect syntax near 'NAME'. E
-
Getting started with WEB reporting
HI, I am working on SAP 4.7 version. I have released my reports through transaction SMW0. Please let me knwo now how do i view and run my reports on web?..... also what URL to type in the adress bar to view the same.... Kindl help... its urgent!