LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matlab and labview/mathscript node

The questions I have are (all cases are for real time signal processing)

 

1)       Can we use nested for loop in Mathscript node?

2)       Which one of these is feasible: 1) Matlab script node

                                                          2) Mathscript node

      3)  Is there any other way to interface between matlab and LV for real time signal processing?

      4)  Suppose X is 1D array (DBL) in Labview. And Mathscript code is as below:

For i=1:inf,

Y= X-1;

end

    

Here X is input and Y is output.

Such code does not produce output (Y variable) in real time processing.

Does it wait till the FOR LOOP ends?  Is there any solution to such problem?

0 Kudos
Message 1 of 4
(2,946 Views)
Hello Tishu,

1)       Can we use nested for loop in Mathscript node?

1) Yes you can. Remember that loops should be avoided as much as possible in m-scrips. Most of the times you can use vectorization to represent same task.

2)       Which one of these is feasible: 1) Matlab script node

                                                          2) Mathscript node

2) What exactly is the "Feasable" question? Real time (see below) or nested loops (see above)

      3)  Is there any other way to interface between matlab and LV for real time signal processing?

3) Real time is different depending the application. Some applications need ns or ps real time (RF appls) others need seconds delay. Real time means "determinism". That a task will execute in a know time with little jitter. Windows is not a real time OS therefore nothing in it will operate in real time. Can you tell us something about the signal your are processing (Audio, Image fps, Radar)?

      4)  Suppose X is 1D array (DBL) in Labview. And Mathscript code is as below:

For i=1:inf,  4) Is this vector a valid one? inf = Inf which is different from 1/eps.

Y= X-1;

end

    

Here X is input and Y is output.

Such code does not produce output (Y variable) in real time processing.

Does it wait till the FOR LOOP ends?  Is there any solution to such problem? 5) What is this suppose to produce?


Let me know,

yardov


Gerardo O.
RF SW Engineering R&D
National Instruments
Message 2 of 4
(2,924 Views)
Thank you,  Yardov. 
 
3)  Is there any other way to interface between matlab and LV for real time signal processing?

3) Real time is different depending the application. Some applications need ns or ps real time (RF appls) others need seconds delay. Real time means "determinism". That a task will execute in a know time with little jitter. Windows is not a real time OS therefore nothing in it will operate in real time. Can you tell us something about the signal your are processing (Audio, Image fps, Radar)

Our project is real time signal acquisition and processing. Someone else in my group has done all data acquisition part and some processing part. My project will work well if I add some coding/programming in it. For that I tried using Matlab/mathscript nodes. But it does not work, as my code has many nested for loops.

      4)  Suppose X is 1D array (DBL) in Labview. And Mathscript code is as below:

For i=1:inf,  4) Is this vector a valid one? inf = Inf which is different from 1/eps.

here Inf means infinite i.e. for real time the control is in users hand, so the infinite loop will break when user gives command. 

Y(i)= X(i) -1; 

end

    

Here X is input and Y is output.

Such code does not produce output (Y variable) in real time processing.

Does it wait till the FOR LOOP ends?  Is there any solution to such problem? 5) What is this suppose to produce?

It should produce another 1D array Y, but as I mentioned earlier, it waits till the loop ends, but loop will not end till user gives command.

0 Kudos
Message 3 of 4
(2,909 Views)
Hi Tishu,

About
3)

How much delay can you tolerate? nano seconds, milliseconds? What's your application? Remember nested loops in m-syntax is not efficient.

4)
The syntax you wrote does not exist in the m-script world. Now if you want to implement what you are saying, use the while syntax. The ending condition will be a user key pressed.
1:inf creates an error in MathScript and does not exist in any other language.

In LabVIEW you do not need to place this while inside MathScript. You will place a LabVIEW while and the code inside so it will execute each iteration. This will be more efficient.

Probably you can post part of your code and we can see little more where the problem relies.
Hope this helps,
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 4 of 4
(2,892 Views)