How can i write this C-Code in G-Code
hallo
how can I write this C-Code in LabVIew ,
for a=0; a=<10; a++
for b=0; b=5 ; b+2
X= 3+b;
Y=1+a;
please see the attachment and tell me where is the problem
Attachments:
Unbenannt 11.vi 43 KB
Well, at least you tried and got some of it right.
I think this should do what you want, but my C is rusty. Is the increment performed before or after the loop executes? If it's after, then I believe the loop should iterate 11 times, not 10.
In any case, you should note that for a literal translation, you would need to add a sequence structure to guarantee that Y was written to only after the inner loop finished because of the way data-flow works.. Also, note that controls and indicators in LabVIEW are not equivalent to variables. They can be used as such, but they usually should not be.
Another point about this is that you probably want to use the correct data type - the orange terminals are floating point indicators (of double precision, in this case) and you want integers.
To learn more about LabVIEW, I suggest you try looking at some of these tutorials.
Try to take over the world!
Attachments:
C.png 4 KB
Similar Messages
-
List v = new Vector() how can i write this ?
List v = new Vector() how can i write this ?
vector does not 'extends' List rather it 'implements' only ......so how can write this way ? ( polymorphism applies only for 'extends' ).my question in a simple way is :
List some_list extends Vector
No, List is an interface; Vector is a concrete class. Read the javadocs.
Vector implements List
>
AND
List some_list implements Vector
are these two same in behaviour
our apart from theoretical differences ?thanks
Interfaces don't have any implementation; they're pure method signatures. When a concrete class implements an interface, it makes a promise that says "I will provide implementations for exactly these methods. Any client can call a method from the interface and I will do something 'sensible' if I'm written correctly."
From the point of view of static and dynamic types, there's no difference between interfaces and classes.
C++ has interfaces, too - they're classes with all pure virtual methods. If you understand how C++ works, the concept shouldn't be hard.
ArrayList is preferred precisely because it isn't synchronized by default. (You can always make it so using java.util.Collections if you wish later on.) If you don't need synchronization, why pay the performance penalty? -
How can I write this string to a file as the ASCII representation in Hex format?
I need to convert a number ( say 16000 ) to Hex string ( say 803E = 16,000) and send it using Visa Serial with the string control in Hex Mode. I have no problem with the conversion (see attached). My full command in the hex display must read AA00 2380 3E...
I can easily get the string together when in Normal mode to read AA0023803E... but how can I get this to hex mode without converting? (i.e. 4141 3030 3233 3830 3345 3030 3030 3031 )
Attachments:
volt to HEX.vi 32 KBSorry, The little endian option was probably introduced in 8.0 (?).
In this special case it's simple, just reverse the string before concatenating with the rest.
It should be in the string palette, probably under "additional string functions".
(note that this only works in this special case flattening a single number as we do here. If the stat structure is more complex (array, cluster, etc.) you would need to do a bit more work.
Actually, you might just use typecast as follows. Same difference.
I only used the flatten operation because of the little endian option in my version.
Message Edited by altenbach on 11-16-2007 11:53 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
littleendian71.png 4 KB
littleEndiancast71.png 4 KB -
Hello
I keep getting an error message when I write the following
<?if:LanguagePreference_ID335='F'?><?'Numéro d’inscription TVQ'?><?end if?>
Is there anyway to write this code and keep the apostraphy?try as below:
<?if:LanguagePreference_ID335='F'?><?'Numéro d?’inscription TVQ'?><?end if?>
Cheers
AJ -
How can I write this small function to create number of Array(s), please?
Guys,
How can I have a function create Array depending upon the passed argument. Am I doing this right?
function createArray(n:int):Array
for(var i:int=0; i<n; i++)
var nArr = new Array();
return nArr[i];
Thanks a lot.var aArraySet:Array = createArraySets(5); //create 5 arrays
// Array 1 -> aArraySet[0]
// Array 2 -> aArraySet[1]
// Array 3 -> aArraySet[2]
// Array 4 -> aArraySet[3]
// Array 5 -> aArraySet[4]
function createArraySets(n:uint):Array
var aArraySet:Array = new Array();
for(var i:uint=0; i<n; i++)
aArraySet.push(new Array());
return aArraySet; -
How can I write this SQL?
the statement have the question:
stxh-tdname length 70
itab-vbeln length 10
select tdobject into table it_stxh
from stxh
for all entries in itab
where ( tdid = 'Z006' and tdspras = 'E' and tdname+0(10) = itab-vbeln and tdobject = 'VBBK' ).
tdname+0(10) = itab-vbeln ???When you define the first Internal Table ITAB, define vbeln as the same type of stxh-tdname.
Eg.
data: begin of itab occurs 0,
vbeln like STXH-TDNAME,
erdat like vbak-erdat,
end of itab.
START-OF-SELECTION.
Select VBELN
ERDAT
from vbak
into CORRSPONDING FIELDS of table itab.
Then you can directly use this ITAB in the next query
select tdobject into table it_stxh
from stxh
for all entries in itab
where ( tdid = 'Z006' and tdspras = 'E' and tdname = itab-vbeln
and tdobject = 'VBBK' ).
Pls reward it if it is useful. -
How can I write this short/simple bit of php so it will work?
Hello!
I have this code in template.php...
<?php @ require_once ("$pagename.php"); ?>
...to bring content into the template.
I've got a folder called 'news' for all the news articles so
how could I edit the code to say 'look for files in the news folder
as well as the current folder'?
I guess I would need something like:
<?php @ require_once ("$pagename.php" or
"news/$pagename.php"); ?>
...but that doesn't work. How would I change it to work?
Thank you very much and hope to hear from you.
MarkYou would need to use the "or" operator in PHP. I'm not too
sure if that
will work or not but you can give it a go - I'm currently at
work now, so I
can't really test anything at this moment in time.
This is the operator for "or" in PHP: ||
Shane H
[email protected]
http://www.avenuedesigners.com
===============================
Proud GAWDS Member
http://www.gawds.org
Delivering accessible websites to all...
===============================
"Spindrift" <[email protected]> wrote in
message
news:e5fhh5$sgv$[email protected]..
> Hello!
>
> I have this code in template.php...
>
> <?php @ require_once ("$pagename.php"); ?>
>
> ...to bring content into the template.
>
> I've got a folder called 'news' for all the news
articles so how could I
> edit
> the code to say 'look for files in the news folder as
well as the current
> folder'?
>
> I guess I would need something like:
>
> <?php @ require_once ("$pagename.php" or
"news/$pagename.php"); ?>
>
> ...but that doesn't work. How would I change it to work?
>
> Thank you very much and hope to hear from you.
>
> Mark
> -
How can we write this in analytical function..
select a.employee_id,a.last_name,b.count from employees a, (select manager_id, count(manager_id) as count from employees group by manager_id) b where a.employee_id=b.manager_id;
As per my requirement I need each manager name and no of employees reporting to him... above query works.. Could anybody help to write the same using analytic function.... Hw this same can be written in effiect way??? (quick performance)
Please also share the link to download some doc to have good understanding of analytical function..
Thanks in advance....are you trying to do a hierarchical type of query?
select ename, count(ename) -1 numr_of_emps_under_this_mgr from emp
connect by empno =prior mgr
group by ename
order by count(ename) desc ;
ENAME NUMR_OF_EMPS_UNDER_THIS_MGR
KING 13
BLAKE 5
JONES 4
CLARK 1
FORD 1
SCOTT 1
ADAMS 0
TURNER 0
MARTIN 0
JAMES 0
SMITH 0
MILLER 0
ALLEN 0
WARD 0Here is the table structure I used (I think you can download it from oracle somewhere)
CREATE TABLE EMP
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10 BYTE),
JOB VARCHAR2(9 BYTE),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2)
SET DEFINE OFF;
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7369, 'SMITH', 'CLERK', 7902, TO_DATE('12/17/1980 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
800, 20);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
Values
(7499, 'ALLEN', 'SALESMAN', 7698, TO_DATE('02/20/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1600, 300, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
Values
(7521, 'WARD', 'SALESMAN', 7698, TO_DATE('02/22/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1250, 500, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7566, 'JONES', 'MANAGER', 7839, TO_DATE('04/02/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
2975, 20);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
Values
(7654, 'MARTIN', 'SALESMAN', 7698, TO_DATE('09/28/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1250, 1400, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7698, 'BLAKE', 'MANAGER', 7839, TO_DATE('05/01/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
2850, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7782, 'CLARK', 'MANAGER', 7839, TO_DATE('06/09/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
2450, 10);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7788, 'SCOTT', 'ANALYST', 7566, TO_DATE('12/09/1982 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
3000, 20);
Insert into EMP
(EMPNO, ENAME, JOB, HIREDATE, SAL, DEPTNO)
Values
(7839, 'KING', 'PRESIDENT', TO_DATE('11/17/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
5000, 10);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
Values
(7844, 'TURNER', 'SALESMAN', 7698, TO_DATE('09/08/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1500, 0, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7876, 'ADAMS', 'CLERK', 7788, TO_DATE('01/12/1983 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1100, 20);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7900, 'JAMES', 'CLERK', 7698, TO_DATE('12/03/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
950, 30);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7902, 'FORD', 'ANALYST', 7566, TO_DATE('12/03/1981 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
3000, 20);
Insert into EMP
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, DEPTNO)
Values
(7934, 'MILLER', 'CLERK', 7782, TO_DATE('01/23/1982 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
1300, 10);
COMMIT; -
Customer Trans Transaction Invoice
Code Date Type Amount
A001 01-JAN-2004 invoice 1000
A001 01-FEB-2004 Receipt -1500
A001 01-MAR-2004 invoice 2000
A001 01-APR-2002 invoice 2500
OUTPUT wanted to be...
Customer Trans Transaction Invoice
Code Date Type Amount Balance
A001 01-JAN-2004 invoice 1000 1000
A001 01-FEB-2004 receipt -1500 500
A001 01-MAR-2004 invoice 2000 2500
A001 01-APR-2002 invoice 2500 5000
Hi All,
Please look into the above data, If analytic function LAG(),CASE expression are possible to locate the cursor position in the single query, then any one can help me out about it. I tried but could not.
Regards,
Neel.You can do this with the SUM analytic function. Taking the emp table, for example,
1 select ename, sal, SUM(sal) OVER (order by empno)
2 from emp
3* order by empno
SQL> /
ENAME SAL SUM(SAL)OVER(ORDERBYEMPNO)
SMITH 800 800
ALLEN 1600 2400
WARD 1250 3650
JONES 2975 6625
MARTIN 1250 7875
BLAKE 2850 10725
CLARK 2450 13175
SCOTT 3000 16175
KING 5000 21175
TURNER 1500 22675
ADAMS 1100 23775
JAMES 950 24725
FORD 3000 27725
MILLER 1300 29025
14 rows selected.Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How can i write this syntax in script logic....
hi all
i need to write below syntax in bpc script logic..
If Headcount = 0, then Salary = 0 Else:
If Month <> March and Month <> September:
Salary = Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)]
If Month = March:
Salary = [Salaryprevious month1 + [(Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)] ] * (100% + Band Annual Increase + Band Annual Increase Factor)
in the above code headcount,salary,bandrate etc all got ids.
thanks guysHi,
In your query, when you say that headcount = 0, do you mean the signed data? In this case, it will difficult to do. When you have a signed data as 0 in SQL, once you optimize the application or compress it, that particular record will go and your logic will not work.
If I look at your logic,
If Headcount = 0, then Salary = 0 Else:
If Month March and Month September:
Salary = Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)
If Month = March:
Salary = [Salaryprevious month1 + (Headcountcurrent month - Headcountprevious month1) * (Band Rate + Band Salary Factor)] * (100% + Band Annual Increase + Band Annual Increase Factor)
If the application has been compressed or optimized, it will not get any record for that particular headcount and will directly go into the "else" loop. Though, its not correct.
I hope you got my point. -
How can I write this query In parameterize form so That I can prevent sql Injection
String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode,"
+ "voucherType,OrderNumber,active,AccountId) "
+ " values('" + txtVhrCode.Text + "','" + ddlModule.SelectedValue.ToString() + "',"
+ "'" + ddlTrans.SelectedValue.ToString() + "','" + txtVhrName.Text + "','" + btnRadio.SelectedValue + "'"
+ ", '" + status.Checked + "', '" + txtAccount.Text + "')";Basically it will look like:
String strQry = "INSERT INTO tblVoucherType (VhrTypeCode,moduleCode,transCCode, ...)"
+ " values(@VhrCode, @moduleCode, @transCCode, ....)";
sqlCommand.Parameters.AddWithValue("@VhrCode", txtVhrCode.Text );
sqlCommand.Parameters.AddWithValue("@moduleCode", ddlModule.SelectedValue.ToString() );
sqlCommand.Parameters.AddWithValue("@transCCode", ddlTrans.SelectedValue.ToString() );
.. and so on
sqlCommand.ExecuteNonQuery();
Olaf Helper
[ Blog] [ Xing] [ MVP] -
How can I write HTML code in this forums
Sorry but I didn't know where to post this thread.....
How can I write HTML code in this forums?Hello,
Every piece of code in your post should be wrapped with the forum tags [ code] and [ /code], without the blanks.
In case of the <a> tag, that is not enough. In this case, you have several options. The most elegant one is to use the entity name for the less-then sign - & lt; - without any spaces. Other options is to add a space between the less-then and the ‘a’ character (and make a note of it) or change the less-then character with a left bracket one.
When posting code, you should always use the forum preview option, just to make sure the forum software “understood” your code correctly.
Hope this helps,
Arie. -
How can i write the below code using "For all entries"
Hi
How can we write the below code using "for all entries" and need to avoid joins...
Please help
SELECT aaufnr aobjnr aauart atxjcd a~pspel
agstrp awerks carbpl cwerks
INTO TABLE t_caufv
FROM caufv AS a
INNER JOIN afih AS b
ON aaufnr = baufnr
INNER JOIN crhd AS c
ON bgewrk = cobjid
AND c~objty = 'D'
WHERE ( a~pspel = space
OR a~txjcd = space
OR NOT a~objnr IN
( select OBJNR from COBRB AS e
WHERE objnr = a~objnr ) )
AND a~werks IN s_plant
AND a~auart IN s_wtype
AND NOT a~objnr IN
( select OBJNR from JEST AS d
WHERE objnr = a~objnr
AND ( dstat = 'A0081'OR dstat = 'A0018' )
AND d~inact 'X' ).
Reward points for all helpfull answers
Thanks
Ammi.Hi,
SELECT objnr objid aufnr
from afih
into table t_afih.
SELECT objnr
from JEST
into table t_JEST
where stat = 'A0045'
OR stat = 'A0046'
AND inact 'X'.
SELECT objnr
from COBRB
into table t_cobrb.
SELECT arbpl werks objid objty
from crhd
INTO table it_crhd
FOR ALL ENTRIES IN it_afih
WHERE objty eq 'D'
AND gewrk = it_afih-objid.
SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
FROM caufv
INTO table t_caufv
FOR ALL ENTRIES IN it_afih
WHERE aufnr = it_afih-aufnr
And pspel = ' '
AND txjcd = ' '
ANd objnr ne it_crhd-objnr
AND auart in s_wtype
AND werks in s_plant.
AND objnr ne it_jest-objnr.
dont use NE in the select statements, it may effect performance also. Instead use if statements inside
loops.
loop at t_caufv.
read table it_chrd............
if t_caufv-objnr ne it_chrd-objnr.
read table it_jest..........
if if t_caufv-objnr ne it_jest-objnr.
(proceed further).
endif.
endif.
endloop.
hope this helps.
Reward if useful.
Regards,
Anu -
How can i write a code to get sume of value from days.
Hi,
how can i write a code to get the sum of value of days(example 1 to 30).
This is in BPS ...
i created multi planning area and creted planning function with {keyfigure name,planning area,days}.
now i want to read all the actual values from basic planing area(basic cube) and calculate the sum of the value.if you have idea can you share the code.
ENTRIES = VARC ( 'zvardays' ). ex(zvardays like 28 days or 29 days or 30 days or 31 days)
COUNT = ENTRIES.
*Get the all the days value from actual
FOREACH PAREA = 'basic planning area'.
COUNT = 1.
DO
SUM = SUM + {amount, count} (amount is a keyfirgure value)
ENDDO.
COUNT = COUNT+1.
SUMACT = SUM.
ENDFOR.
can you correct the above code ....to read the values and sum of the those value.
Thanks...Hi ..
That is ok..
Can you provide sample code for my requirement..
and also how can i pass the error message (can you help me syntax )
and if my acutal-total is not equal to plan-total then
i have to pass the error message and then i have to restrict save the data how i can i restrict(user can not save the data until the values should be equal) .
Can you help me it is very urgent..
thanks.//
Edited by: Eyda rose on Jun 4, 2008 9:29 PM -
i am running some vis in frames of sequence frome frame number 1 to frame 10.after this i would like to create one other vi with some strings and i want to save it to disk with a save button. i am opening,writing and closing the data.what i want is that a save button to write the file .moreover i would like to run the application first and then press the safe button to write it to disk.i am sending you the vi. please can you tell me how can i correct this vi?
Attachments:
savestrings.vi 80 KBHere's a picture of a while loop around part of your code. All it's doing is waiting to write until the user presses the save button. If you need it to do more, explain in more detail.
Attachments:
While_Loop.jpg 17 KB
Maybe you are looking for
-
My list of things I'd like changed/fixed: No carriage return/new line facility in Mail / Text editing (unless there's a key combo for it ?). This is a real pain for me currently. In SMS / Text editing the Reply To and Delete Text options should be ab
-
Problem in reading Text file(Unicode)
Hi i am trying to read a tab delimited text file which has Unicode Encoding try{ BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( "C:/Documents and Settings/divya.parkash/Desktop/Test
-
Discussion Board Error For Community Sorry Some thing went wrong can not complete this action
HI All, we migrated the IBM community's to SharePoint 2013 using tool,I taken the back up of that community site in SharePoint and i restored it in different SharePoint2013 Environment. When we trying to create any new discussion in Discussion Board
-
How to change Content-Transfer-Encoding for mail sending
Hello Experts, I need to send some documents through mail which i am doing with the help of cl_output_service=>document_output method. Mail is been send succesfully. But in the payload content which got from Exchange server: X-Mailer: SAP Web Appl
-
K9N2GM loading sound drivers problem
Originally machine was loaded with XP SP2 and factory supplied drivers on CD (XP) All was sweet. SP3 was installed - still OK. Windoze went slow so I have started from scratch and installed XP Home SP3 this time from original as always CD from M$. Al