How to call a function in "matlab script"
Hellow!
I am using Matlab scrip to make some matlab program in Labview,but i find when i try to call a matlab function like"myfun.m",it will ouput error message"undefined command myfun. So what should i do to call function in matlab script? thanks!
Happybird,
Do you have MATLAB installed on the computer? LabVIEW makes calls
to MATLAB to run the script node. If so, make sure that you have
launched MATLAB and then launch LabVIEW. Once you have tried
that, <a
href="http://digital.ni.com/public.nsf/websearch/4475BC3CEB062C9586256D750058F14B?OpenDocument">KB
300A6NDT</a> might be helpful. Hope this information helps!
Andy F.
National Instruments
Similar Messages
-
/How to call a function in another PowerShell script
Hi All,
I want to use dot-sourced method to call the function from other script,While calling Function.ps1 from the second script there is a Null value in the beginning,
How can we ignore this null value or there is a better approach of doing it without using Import-Module.
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
add $a $b
#===========End==================
The second script which has been dot-source to call the function
#================Main script==========
. C:\Users\Anirban\Desktop\Tester.ps1 |Out-Null
add 1 2
#================================
Regards,
Anirban SinghaDot Sourcing is adding the function ADD to console environment and the script is acting like a module vs a script with parameters.
The Add $a $b line should be removed. (Where are $a and $b defined?)
They are not defined hence, "The Value is " blank line
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
add $a $b
Should be
#=======Function.ps1============
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
PS C:\Test> . c:\tester.ps1
Add 1 2
Add 3 4
The value is 3
The value is 7
However the add can work without dot sourcing the script file by parameterizing the script
#=======Function.ps1============
Param ($a,$b) # Parameters to the script
function add($x,$y)
$z=$x+$y
Write-Host "The value is $Z"
Add $a $b # body of script
PS C:\Test>
C:\Tester.ps1 1 2
C:\Tester.ps1 3 4
The value is 3
The value is 7 -
Calling a SubVI in MatLab script?
Can you call a subVI in MatLab script node, or does the SubVI 'node' always have to be used?
If this can be done, how is it done - can 'load' be used followed by the subVI address on the computer?
Any help would be much appreciated!
Thank you in advance,
DaniThanks, I don't really understand what 'redundant indexing' is, as I'm unsure how to change the code! I've attached the coefficient table and a picture of the script if you could take a look that'd be great! I've commented out most of the code to see if I can just get one value out first of all. I'm unsure where to go from here - I can't figure out how to attach the VI by itself, sorry!
Thanks so much,
Dani
Attachments:
low T coeffs.jpg 233 KB
matlabscript.jpg 187 KB -
How to call javascript function?
Hi,
How to call javascript function for SAP button
control onclick event?
Thanks in advance.Hi Sundar,
u can call java script in design mode.
Add this code in ur design part inside body and call the function as
<sap:button id="a" onSelect="javascript:go();"
Add inside body:
<script language="javascript>
function go(){
alert("hai");
</script>
Regards,
Vinoth.M -
How to call javascript function from PL/SQL procedure
Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?
Hi,
I have a requirement to call Javascript function inside a After Submit Process.
clear requirement below:
1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
2. user clicks on "save files" button
3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
Hope this clarify U.
Krishna. -
How to call java function from PL/sql in oracle applications
I am trying to call a java function from plsql procedure. Can any one explain how to call java function, and in which directory I have to store my java function in oracle applications. Do I need to register that java function from Application developer.
Thanks
Kranthihttp://www.oracle.com/technology/tech/java/jsp/index.html
Good Luck,
Avi. -
How to call stored function in my jsp
how to call stored function in my jsp?
please give me a example.Hi,
think we need mor einformation, like JDeveloper release and the how you do access the database (JDBC, BC4J, EJB,ADF...)
Frank -
How to call oracle function from ejb3
i'm trying to call an oracle query-function from ejb3.
The oracle function:
create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
m_sql VARCHAR2(250);
BEGIN
m_sql:='select count(thrId) from thread where secId='|| secid||'
and thrAvai='|| avai;
open cur for m_sql;
return cur;
END;
I'v tried several ways to call it,but all failed:
1. the calling code:
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");
query.setParameter(1, secId);
query.setParameter(2, avai);
return query.getSingleResult();
but i got the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
ORA-06550: row 1, col 7:
PL/SQL: Statement ignored
2. the calling code:
@SqlResultSetMapping(name = "getSecThreadCount_Mapping")
@NamedNativeQuery(name = "getSecThreadCount",
query = "{?=call getSecThreadCount(:secId,:avai)}",
resultSetMapping = "getSecThreadCount_Mapping",
hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
@QueryHint(name = "org.hibernate.readOnly", value = "true")})
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNamedQuery("getSecThreadCount");
query.setParameter("secId", secId);
query.setParameter("avai", avai);
return query.getSingleResult();
but i run into the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
Could anyone tell me how to call the function from EJB3?
Thanks.Here's a working model:
package.procedure: (created in example schema scott)
CREATE OR REPLACE package body data_pkg as
type c_refcursor is ref cursor;
-- function that return all emps of a certain dept
function getEmployees ( p_deptId in number
return c_refcursor
is
l_refcursor c_refcursor;
begin
open l_refcursor
for
select e.empno as emp_id
, e.ename as emp_name
, e.job as emp_job
, e.hiredate as emp_hiredate
from emp e
where e.DEPTNO = p_deptId;
return l_refcursor;
end getEmployees;
end data_pkg;
/entity class:
package net.app.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table (name="emp")
@SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
@NamedNativeQuery( name = "getEmpsByDeptId"
, query = "{ ? = call data_pkg.getEmployees(?)}"
, resultClass = Employee.class
, hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
, @QueryHint(name = "org.hibernate.readOnly", value = "true")
public class Employee implements Serializable
@Id
@Column(name="emp_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
private int id;
@Column(name="emp_name")
private String name;
@Column(name="emp_job")
private String job;
@Column(name="emp_hiredate")
private Date hiredate;
// constructor
public Employee (){}
// getters and setters
public int getId()
return id;
etc...session bean:
package net.app.entity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
@Stateless
public class ScottAdminImpl implements ScottAdmin
@PersistenceContext
private EntityManager entityManager;
@SuppressWarnings("unchecked")
public List<Employee> getEmployeesByDeptId(int deptId)
ArrayList<Employee> empList;
try
Query query = entityManager.createNamedQuery("getEmpsByDeptId");
query.setParameter(1, deptId);
empList = (ArrayList<Employee>) query.getResultList();
return empList;
catch (Exception e)
e.printStackTrace(System.out);
return null;
}client:
package net.app.client;
import java.util.List;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
public class ScottClient
public static void main(String[] args)
try
// create local interface
InitialContext ctx = new InitialContext();
ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
// select employees by deptno
int deptno = 20;
List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
// output
System.out.println("Listing employees:");
for (Employee emp : empList)
System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
catch (NamingException e)
e.printStackTrace(System.out);
}Basically you just ignore the refcursor outbound parameter.
This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
Edited by: _Locutus on Apr 2, 2009 2:37 PM -
How to use SQL() function while writing scripts in BODS 4.0
How to use SQL() function while writing scripts in BODS 4.0
Hello,
I think you want to post your question to the [Data Integration and Data Quality Management|Data Services and Data Quality; forum. This forum is for other BusinessObjects SDK development questions.
Sincerely,
Dan Kelleher -
How can call a function module(RFC)in one server to another sever in my rep
How can call a function module(RFC)in one server to another sever in my report program.
What i am know whenever rfc enabled immediately radio button checks then only it will come.
please justify.Syntax
CALL FUNCTION func DESTINATION dest [EXPORTING p1 = a1 p2 = a2 ...]
[IMPORTING p1 = a1 p2 = a2 ...]
[CHANGING p1 = a1 p2 = a2 ...]
[TABLES t1 = itab1 t2 = itab2 ...]
[EXCEPTIONS [exc1 = n1 exc2 = n2 ...]
[system_failure = ns [MESSAGE smess]]
[communication_failure = nc [MESSAGE cmess]]
[OTHERS = n_others]].
http://help.sap.com/saphelp_47x200/helpdata/en/22/042537488911d189490000e829fbbd/frameset.htm -
How to call java function in javascript
Hello Everyone,
Can anyone tell me solution that:
How to call java function in javascript?
Thanks,
VIDsYou can't since Java is running on the server and javascript is running in the browser long after the Java side of things has finished executing. Assuming you're not talking about an applet here.
But you can make calls back to the server through Ajax. All you need is something like a servlet on the receiving end which you can invoke through Ajax; from that point you can execute any Java code you want. -
How to call a subroutine in a script ?
Hi ,
How to call a subroutine in a script ?
bye,
Satya.Hello,
Syntax goes like this
/: PERFORM <form> IN PROGRAM <prog>
/: USING &INVAR1&
/: USING &INVAR2&
/: CHANGING &OUTVAR1&
/: CHANGING &OUTVAR2&
/: ENDPERFORM
INVAR1 and INVAR2 are variable symbols and may be of any of the four SAPscript symbol types.
OUTVAR1 and OUTVAR2 are local text symbols and must therefore be character strings.
Example:
In script form
/: PERFORM READ_TEXTS IN PROGRAM 'Z08M1_FORM_EKFORM1'
/: USING &EKKO-EKORG&
/: USING &EKPO-WERKS&
/: USING &EKKO-EKGRP&
/: USING &EKKO-BSTYP&
/: CHANGING &COMPNAME&
/: CHANGING &SENDADR&
/: CHANGING &INVCADR&
/: CHANGING &COMPADR&
/: CHANGING &COVERLTR&
/: CHANGING &SHIPADR&
/: CHANGING &REMINDER&
/: CHANGING &REJECTION&
/: CHANGING &POSTADR&
/: CHANGING &LOGO&
/: ENDPERFORM
In program
FORM Read_texts - To extract the standard texts from the table *
FORM READ_TEXTS TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA : L_EKORG TYPE EKORG,
L_WERKS TYPE WERKS_D,
L_BSTYP TYPE BSTYP,
L_EKGRP TYPE BKGRP.
READ TABLE IN_PAR WITH KEY 'EKKO-EKORG' .
CHECK SY-SUBRC = 0.
L_EKORG = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY 'EKPO-WERKS' .
CHECK SY-SUBRC = 0.
L_WERKS = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY 'EKKO-EKGRP' .
CHECK SY-SUBRC = 0.
L_EKGRP = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY 'EKKO-BSTYP' .
CHECK SY-SUBRC = 0.
L_BSTYP = IN_PAR-VALUE.
CLEAR Z08M1_ORG_TEXTS.
SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
AND WERKS = L_WERKS
AND EKGRP = L_EKGRP
AND BSTYP = L_BSTYP.
IF SY-SUBRC NE 0.
SELECT SINGLE * FROM Z08M1_ORG_TEXTS WHERE EKORG = L_EKORG
AND WERKS = L_WERKS
AND EKGRP = L_EKGRP
AND BSTYP = SPACE.
ENDIF.
READ TABLE OUT_PAR WITH KEY 'COMPNAME'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COMP.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'SENDADR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_ADRS.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'INVCADR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_INVC.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'COMPADR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_CPAD.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'COVERLTR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_COVR.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'SHIPADR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_SHIP.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'REMINDER'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RMDR.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'REJECTION'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_RJCT.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'POSTADR'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_POST.
MODIFY OUT_PAR INDEX SY-TABIX.
READ TABLE OUT_PAR WITH KEY 'LOGO'.
OUT_PAR-VALUE = Z08M1_ORG_TEXTS-TXT_LOGO.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
Hope this helps.
Regards -
How to call a function having OBJECT type as Return type
Hi,
I've the following function returning OBJECT type.
Pease advice me how to call this function
CREATE OR REPLACE TYPE GET_EMP_OBJ is object
( emp_name varchar2(50) ,
mgr_id number,
dept_id number
CREATE OR REPLACE FUNCTION get_emp(P_emp_no NUMBER )
RETURN GET_EMP_OBJ IS
t_emp_info GET_EMP_OBJ ;
v_ename EMP.ename%TYPE;
v_mgr EMP.mgr%TYPE ;
v_deptno EMP.deptno%TYPE;
v_ename1 EMP.ename%TYPE;
v_mgr1 EMP.mgr%TYPE ;
v_deptno1 EMP.deptno%TYPE;
BEGIN
FOR rec IN ( SELECT ename , mgr , deptno
FROM emp )
LOOP
v_ename := rec.ename ;
v_ename1 := v_ename1||'|'||v_ename ;
v_mgr := rec.mgr ;
v_mgr1 := v_mgr1||'|'||v_mgr ;
v_deptno:= rec.deptno;
v_deptno1 := v_deptno1||'|'||v_deptno ;
END LOOP ;
t_emp_info := GET_EMP_OBJ (v_ename,v_mgr,v_deptno ) ;
RETURN t_emp_info ;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.put_line ('Error'||SQLCODE||','||SQLERRM ) ;
END;The above function got created successfully.
And i'm confused how to call this functions. I tried like below but didn't work
DECLARE
t_emp_info_1 GET_EMP_OBJ ;
BEGIN
t_emp_info_1 := get_emp(7566) ;
for i in 1..t_emp_info_1.COUNT
LOOP
DBMS_OUTPUT.put_line ('Values are'||i.emp_name ) ;
END LOOP;
END;SQL> CREATE OR REPLACE TYPE GET_EMP_OBJ is object
2 ( emp_name varchar2(50) ,
3 mgr_id number,
4 dept_id number
5 );
6 /
Type created.
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE FUNCTION get_emp(empno NUMBER )
2 RETURN GET_EMP_OBJ IS
3 t_emp_info GET_EMP_OBJ ;
4 BEGIN
5 begin
6 select get_emp_obj(ename, mgr, deptno) into t_emp_info
7 from emp
8 where empno = get_emp.empno;
9 exception
10 when no_data_found then
11 t_emp_info := new get_emp_obj(null,null,null);
12 end;
13 return t_emp_info;
14* END;
SQL> /
Function created.
SQL> set serverout on
SQL>
SQL> declare
2 t_emp_info GET_EMP_OBJ ;
3 BEGIN
4 t_emp_info := get_emp(7566);
5 DBMS_OUTPUT.put_line ('Values are: '||t_emp_info.emp_name||', '||t_emp_info.mgr_id||', '||t_emp_info.dept_id);
6 END;
7 /
Values are: JONES, 7839, 20
PL/SQL procedure successfully completed.
SQL> -
As part of my attempts to make FLEX 508 compliant, I've tried several things. But this question is about basic FLEX in general. What I'm trying to do is to call a routine (that will someday work and make FLEX compliant I hope). Here is the basic layout in the mxml file:
<mx:Script source="/scripts/FSUtil.as" />
<mx:Script source="/scripts/FSCalc.as" />
<mx:Script source="/scripts/FSLangSwitch.as" />
<mx:Script>
<![CDATA[
accessibleSet();
]]>
</mx:Script>
"accessibleSet" is located in the FSUtil.as file. The error from the invocation above is:
1180: Call to a possibly undefined method accessibleSet.
This is what it looks like (note the code creates an error):
public function accessibleSet():void {
headerDHSImage.accessibilityProperties.description = 'State of Illinois Department of Human Services logo';
The error is:
1120: Access of undefined property headerDHSImage.
But I don't think the basic idea of calling a function from the script section of an mxml file is affected by this.
Just for completeness, headerDHSImage is defined in a component called DHSHeader.mxml as:
<mx:Image id="headerDHSImage"
source="images/DHSLogo.gif"
toolTip="State of Illinois Department of Human Services Logo"
left="5" top="5"/>
This component is displayed when the application runs so I know that connection is working.
Recap:
I want to call a function from the script area of an mxml file, but am not sure of the protocol.
Thanks,
Jerry> If I understand it at all, then in the mxml application tag you can only refer to functions
> that are within a naked script tag (only locally). That is, you can't refer to a function
> that is in an associated script file via the script source method.
No, this is incorrect. There is no difference between declaring a function like accessibleSet() within the <Script> tag and declaring it in an AS file included by a <Script> tag. The problem is where you can call that function from. You normally do not write "loose code" in a <Script> tag like
<Script>
accessibleSet();
</Script>
If you do, it actually becomes part of an autogenerated class initialization ("cinit") method emitted by the compiler, which isn't what you're expecting, because at class initialization time no instances even exist and you can only read and write static vars.
Another way to understand it is this: When you write an MXML file, you are writing a class. For example, suppose you write MyApp.mxml as
<mx:Application>
<mx:Script>
accessibleSet();
<mx:Script>
<mx:Button id="b"/>
</mx:Application>
This is more-or-less equivalent to writing the AS class
public class MyApp extends Application
accessibleSet();
var b:Button = new Button();
If you are familiar with writing classes, you should see the problem here: A class body doesn't normally contain loose function calls or other loose statements. Instead, a class body is supposed to contain 'const', 'var', and 'function' declarations. So you need to call a method like accessibleSet() inside another method -- such as an event handler -- that runs at a well-defined time.
BTW, you are probably going to confuse yourself further if you continue splitting your code for a single application into multiple AS files which you then include with <Script> tags. All of this code goes into one class and therefore it really belongs either inside the <Script> tag itself or in a single AS file brought in by a single <Script> tag. You need to think in terms of classes, not files.
Gordon Smith
Adobe Flex SDK Team -
How to call a function every 45 minutes?
Hi..
How to call a function after 45 minutes evry day..
That function returns a value.
Which is best? Thread or using timestamp?
RegardsHello Joe,
I heard of this website, gurgle something, that actually let's you put in words like "java" and "scheduling" and it will spit out other websites that mention these terms. Fascinating stuff, hopefully I'll find the time to test it someday soon..
Lucky for you I have an article discussing solutions to your problem in my bookmarks:
http://www.ibm.com/developerworks/web/library/j-schedule.html
With kind regards
Ben
Maybe you are looking for
-
I am looking to sell my MacBook pro but i dont know how to spec it up
Hi there, I am a new macuser, however am looking to sell my macbook pro as i want to get the new tablet when it comes out. Please excuse my ignorance, however will anyone be able to tell me how to spec this up ? i dont know what the MPN is, however i
-
How to change the language in my printer hp officejet 4620?
How to change the language in my printer hp officejet 4620?
-
Unicode and databases support urgent help
Hello! i want to know that how we can store the unicode characters in a database. is this necessary for a database to support unicode or is there any other way to do this. Qaiser Mehmood [email protected]
-
Blog/Podcast videos won't play in Internet Explorer
Ever since I upgraded our 10.5 server to 10.6 (currently running 10.6.8 update 1.1, users have been unable to watch videos that were added to the blog server using Internet Explorer. We tried them on a bunch of various Windows machines but the video
-
PO doesnot exixt while creating purchase order
Hi all, I am getting an error while creating purchase order that " PO number doesnot exist". When I repeat creating it, PO with next number is getting created. What could be the reason for this?