11-28-2014 01:07 PM
how can i skip iteration in for loop of labview.?
as we simply do this in matlab like this
for i=1:32:256
11-28-2014 01:51 PM
You cannot skip an iteration in LabVIEW.
Depending on how you define mathematically the iterations you want to perform or skip, you can use a case structure with an empty case for the skipped values or you can do some math on the value of i to create an index "j" for your process.
Be aware that LV arrays and loops start with index 0 while Matlab starts at 1.
Lynn
11-28-2014 02:13 PM
11-28-2014 02:19 PM - edited 11-28-2014 02:23 PM
Hi nouman,
Can u suggest a simpler way or any math operation to do this.
I guess "1:32:256" defines a list of values like "1, 33, 65, 97, …".
To have an easier way you could use some simple math like "i*32+1" in your loop with "i" being the loop iterator!
Using case structure with empty case for skipped values will be a long process as i want to skip 32 counts.
Here reading the LabVIEW help for the case structure might be a great source of wisdom!
You can define ranges like "2..32", "34..64", "66..96" for just one case - as explained in the help…
11-28-2014 02:27 PM
Tell us more about exactly what you want to do. GerdW gave suggestions for two somewhat different interpretation of what you want.
You may be able to create an array of your desired "i" values using Ramp.vi. Many numeric and math functions are polymorphic, meaning that they accept array inputs and may generate array outputs. It is possible that you may not need a loop at all, depending on your algorithm.
Lynn
11-28-2014 03:07 PM
i am doing some image processing techniques (image enhancement). I have the matlab code i am just implementing it on labview
Here is what i have done so for on labview by using this matlab code
image=imread('C:\Users\Nouman Ashraf\Desktop\cameraman12.png');
I = 255-double(image);
[w,h] = size(I);
%out = I;
w1=floor(w/32)*32;
h1=floor(h/32)*32;
inner = zeros(w1,h1);
for i=1:32:w1
for j=1:32:h1
a=i+31;
b=j+31;
F=fft2( I(i:a,j:b) );
factor=abs(F).^f;
block = abs(ifft2(F.*factor));
larv=max(block(:));
if larv==0
56
larv=1;
end;
block= block./larv;
inner(i:a,j:b) = block;
end;
end;
final=inner*255;
final=histeq(uint8(final));
11-28-2014 03:18 PM
Hi nouman,
sometimes it's better to have atleast basic understanding of the programming language you want to use…
- You're looking for array subsets of certain size. You're trying to create loops to iterate over your picture. Just start with creating those two for loops to index those subsets, later on you may include the FFT math too.
- Using that floor function is like translating a text word by word. Why not use a simple Quot&Rem function?