LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write this matlab code in labview?

for those who can program both MATLAB and LabVIEW, how can I write this MATLAB code in LabVIEW language?

 

=====================================================================

% Druckmessung

global druck_analogin druckw WertSYS druck_mmHg_8 handlescurrentPressure

druckwert_u16_vektor = [];

t1 = tic;

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

pause(0.1);

druckwert_u16 = druck_analogin.read_u16;

% Wert auslesen

druckwert_u16_vektor = [druckwert_u16_vektor druckwert_u16];

 

druck_u16_mittel = median(druckwert_u16_vektor);

druck_mmHg_8 = round((druck_u16_mittel-29974)/43.09);

% Umrechnung mmHg

set(handlescurrentPressure,

'String',[num2str(druck_mmHg_8) ' mmHg']);

 

 

druckwert_u16_vektor = [];

t2 = toc(t1);

fprintf(

'Dauer Auslesen: %d s.\n',t2);

========================================================

 

I'll be thankful if someone can help as I'm bad at coding and don't quite get how does this function work!!!

 

thanks!

 

0 Kudos
Message 1 of 2
(2,429 Views)

Hi Valdi,

 

You can use a math script node, it should be in the structures palet and should look like a blue box. You can just copy and paste your .m scipt into the box see this link

Regards

Andy
_______________________________________

"To 'G' and not to 'C', this is not a question!"
0 Kudos
Message 2 of 2
(2,391 Views)