09-15-2013 08:00 AM
Hi,
Is it possible to change this C code into labview nested array with 2 inputs ? ![]()
Thank you.
Solved! Go to Solution.
09-15-2013 09:22 AM
Of course it is!
This code:
for(i=0;i<height;i++) {
for(j=0;j<width;j++) {
if(a[i][j]>240) {
a[i][j]=255;
}
else {
a[i][j]=0;
}
}
}
Could look like this:
You should be able to finish the rest ![]()
09-15-2013 07:57 PM
Thankx Craig,
Im new to labveiw so i'll give my best shot to complete and upload the VI here .Can you please help to review this final VI?
Thankx in advance. (Y)
09-15-2013 08:13 PM
That is a VI snippet. You can drag the image to your LabVIEW block diagram and you'll have the code. (Assuming you have LV 2013 since the VI was created as a 2013 version.)
09-15-2013 08:27 PM - edited 09-15-2013 08:32 PM
montu.dada wrote:Is it possible to change this C code into labview nested array with 2 inputs ?
![]()
What is the second input??
Here's a no-loop solution (assuming a single input of a 2D array). 😄

Or this (a little less universal. only works for unsigned integers)

09-16-2013 06:18 AM
Now,
I couldn't figure it out to deal with if statements. Can tyo suggest me about this section please?
for(j=60;j<120;j++) {
if(a[30][j+1]!=a[30][j]) {
if(a[30][j+3]!=a[30][j]) {
h_count=h_count+1;
}
}
}
Regards.
montu
09-16-2013 06:33 AM
09-16-2013 06:43 AM
@montu.dada wrote:
Now,
I couldn't figure it out to deal with if statements. Can tyo suggest me about this section please?
for(j=60;j<120;j++) {
if(a[30][j+1]!=a[30][j]) {
if(a[30][j+3]!=a[30][j]) {
h_count=h_count+1;
}
}
}
Regards.
montu
You need 2 index arrays and a Equal comparison.
/Y
09-16-2013 07:11 AM
it that what you mean?
Thankx.
09-16-2013 07:44 AM
How can we initialize the for loop to 60?
thankx.