Delete deprecated functions

Delete deprecated functions

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.

// This file is released under the 3-clause BSD license. See COPYING-BSD.

function MLink()

    global %microdaq;
    etc_tlbx  = mdaq_toolbox_path();
    etc_tlbx  = etc_tlbx + filesep()+'etc'+filesep()+'mlink'+..
                    filesep()+'MLink'+filesep();
    MLink_path = etc_tlbx + 'MLink';

    [version, opts] = getversion();
    if opts(2) == "x64" then
        MLink_path = strcat([MLink_path, "64"]);
    else
        MLink_path = strcat([MLink_path, "32"])
    end

    [OS,version] = getos()
    if (getos() == "Windows") then
       MLink_path = strcat([MLink_path, ".dll"])
    end
    if (getos() == "Linux") then
       MLink_path = strcat([MLink_path, ".so"])
    end

    // NOT SUPPORTED
    if (getos() == "SunOS") then
       disp("Solaris is not supported!");
    end
    if (getos() == "Darwin") then
       MLink_path = strcat([MLink_path, ".dylib"])
    end

    // Link library
    %microdaq.private.mlink_link_id = link(MLink_path, ["sci_mlink_error"..
                               "sci_mlink_connect"..
                               "sci_mlink_disconnect"..
                               "sci_mlink_disconnect_all"..
                               "sci_mlink_dsp_load"..
                               "sci_mlink_dsp_start"..
                               "sci_mlink_dsp_upload"..
                               "sci_mlink_dsp_stop"..
                               "sci_mlink_dsp_profile_get"..
                               "sci_mlink_dsp_param"..
                               "sci_mlink_set_obj"..
                               "sci_client_connect"..
                               "sci_signal_get"..
                               "sci_signals_get"..
                               "sci_signals_get_config"..
                               "sci_signal_register"..
                               "sci_client_disconnect"..
                               "sci_mlink_mem_set2"..
                               "sci_mlink_mem_get2"..
                               "sci_mlink_ai_read"..
                               "sci_mlink_ao_write"..
                               "sci_mlink_ai_scan_init"..
                               "sci_mlink_ai_scan_get_ch_count"..
                               "sci_mlink_ai_scan"..
                               "sci_mlink_ai_scan_stop"..
                               "sci_mlink_dio_set"..
                               "sci_mlink_dio_get"..
                               "sci_mlink_dio_set_dir"..
                               "sci_mlink_dio_set_func"..
                               "sci_mlink_led_set"..
                               "sci_mlink_func_key_get"..
                               "sci_mlink_enc_reset"..
                               "sci_mlink_enc_get"..
                               "sci_mlink_pwm_config"..
                               "sci_mlink_pwm_set"..
                               "sci_mlink_pru_reg_get"..
                               "sci_mlink_pru_reg_set"..
                               "sci_mlink_hwid"..
                               "sci_mlink_version"..
                               "sci_mlink_fw_upload"..
                               "sci_mlink_udp_open"..
                               "sci_mlink_udp_recv"..
                               "sci_mlink_udp_close"..
                               "sci_mlink_ao_scan_init"..
                               "sci_mlink_ao_scan"..
                               "sci_mlink_ao_scan_stop"..
                               "sci_mlink_ao_scan_data"..
                               ], 'c');
endfunction

MLink();
clear MLink

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.

// This file is released under the 3-clause BSD license. See COPYING-BSD.

function MLink()

    global %microdaq;
    etc_tlbx  = mdaq_toolbox_path();
    etc_tlbx  = etc_tlbx + filesep()+'etc'+filesep()+'mlink'+..
                    filesep()+'MLink'+filesep();
    MLink_path = etc_tlbx + 'MLink';

    [version, opts] = getversion();
    if opts(2) == "x64" then
        MLink_path = strcat([MLink_path, "64"]);
    else
        MLink_path = strcat([MLink_path, "32"])
    end

    [OS,version] = getos()
    if (getos() == "Windows") then
       MLink_path = strcat([MLink_path, ".dll"])
    end
    if (getos() == "Linux") then
       MLink_path = strcat([MLink_path, ".so"])
    end

    // NOT SUPPORTED
    if (getos() == "SunOS") then
       disp("Solaris is not supported!");
    end
    if (getos() == "Darwin") then
       MLink_path = strcat([MLink_path, ".dylib"])
    end

    // Link library
    %microdaq.private.mlink_link_id = link(MLink_path, ["sci_mlink_error"..
                               "sci_mlink_connect"..
                               "sci_mlink_disconnect"..
                               "sci_mlink_disconnect_all"..
                               "sci_mlink_dsp_load"..
                               "sci_mlink_dsp_start"..
                               "sci_mlink_dsp_upload"..
                               "sci_mlink_dsp_stop"..
                               "sci_mlink_dsp_profile_get"..
                               "sci_mlink_dsp_param"..
                               "sci_mlink_set_obj"..
                               "sci_client_connect"..
                               "sci_signal_get"..
                               "sci_signals_get"..
                               "sci_signals_get_config"..
                               "sci_signal_register"..
                               "sci_client_disconnect"..
                               "sci_mlink_mem_set2"..
                               "sci_mlink_mem_get2"..
                               "sci_mlink_ai_read"..
                               "sci_mlink_ao_write"..
                               "sci_mlink_ai_scan_init"..
                               "sci_mlink_ai_scan_get_ch_count"..
                               "sci_mlink_ai_scan"..
                               "sci_mlink_ai_scan_stop"..
                               "sci_mlink_hs_ai_init"..
                               "sci_mlink_hs_ai_read"..
                               "sci_mlink_dio_set"..
                               "sci_mlink_dio_get"..
                               "sci_mlink_dio_set_dir"..
                               "sci_mlink_dio_set_func"..
                               "sci_mlink_led_set"..
                               "sci_mlink_func_key_get"..
                               "sci_mlink_enc_reset"..
                               "sci_mlink_enc_get"..
                               "sci_mlink_pwm_config"..
                               "sci_mlink_pwm_set"..
                               "sci_mlink_pru_reg_get"..
                               "sci_mlink_pru_reg_set"..
                               "sci_mlink_hwid"..
                               "sci_mlink_version"..
                               "sci_mlink_fw_upload"..
                               "sci_mlink_udp_open"..
                               "sci_mlink_udp_recv"..
                               "sci_mlink_udp_close"..
                               "sci_mlink_ao_scan_init"..
                               "sci_mlink_ao_scan"..
                               "sci_mlink_ao_scan_stop"..
                               "sci_mlink_ao_scan_data"..
                               ], 'c');
endfunction

MLink();
clear MLink


Delete VWFA_Localizer_MRI.sce

Delete VWFA_Localizer_MRI.sce

#######################################################
# Visual Word Form Area Localizer - blocked fMRI
# O. Colizoli 	2011
#
# Presentation SCE file
# Dutch vs. Chinese words (ABAB)
# 16 seconds active, 16 sec baseline (fixation cross)
# Only 4-letter/character words used
# Instructions - passive viewing, maintain fixation
# 9 blocks per condition
#######################################################

scenario = "VWFA_Localizer_MRI";

default_background_color = 255, 255, 255;
default_font = "courier new";
default_font_size = 60;
default_text_color = 0,0,0;
response_matching = simple_matching;
response_logging = log_all;
active_buttons = 4;
button_codes = 1,2,3,4;

#scenario_type = fMRI_emulation; # only here to make emulation possible if desired
#scan_period = 2000;   # (ms) only here to make emulation possible if desired
scenario_type = fMRI;
pulses_per_scan = 1;
pulse_code = 255;

begin;

################ STIMULUS DEFINITIONS ################

array{ # 144 words
text	{caption	=	"TIEN"	;	description	=	"	TIEN	"	;}	;
text	{caption	=	"ECHT"	;	description	=	"	ECHT	"	;}	;
text	{caption	=	"ENIG"	;	description	=	"	ENIG	"	;}	;
text	{caption	=	"OVER"	;	description	=	"	OVER	"	;}	;
text	{caption	=	"STOF"	;	description	=	"	STOF	"	;}	;
text	{caption	=	"LUST"	;	description	=	"	LUST	"	;}	;
text	{caption	=	"DANK"	;	description	=	"	DANK	"	;}	;
text	{caption	=	"VORM"	;	description	=	"	VORM	"	;}	;
text	{caption	=	"NAME"	;	description	=	"	NAME	"	;}	;
text	{caption	=	"UREN"	;	description	=	"	UREN	"	;}	;
text	{caption	=	"BOEK"	;	description	=	"	BOEK	"	;}	;
text	{caption	=	"VELD"	;	description	=	"	VELD	"	;}	;
text	{caption	=	"WANG"	;	description	=	"	WANG	"	;}	;
text	{caption	=	"ZULT"	;	description	=	"	ZULT	"	;}	;
text	{caption	=	"KANS"	;	description	=	"	KANS	"	;}	;
text	{caption	=	"ETEN"	;	description	=	"	ETEN	"	;}	;
text	{caption	=	"ALLE"	;	description	=	"	ALLE	"	;}	;
text	{caption	=	"GOLF"	;	description	=	"	GOLF	"	;}	;
text	{caption	=	"REIS"	;	description	=	"	REIS	"	;}	;
text	{caption	=	"DOEN"	;	description	=	"	DOEN	"	;}	;
text	{caption	=	"VLUG"	;	description	=	"	VLUG	"	;}	;
text	{caption	=	"HUID"	;	description	=	"	HUID	"	;}	;
text	{caption	=	"HEMD"	;	description	=	"	HEMD	"	;}	;
text	{caption	=	"TERM"	;	description	=	"	TERM	"	;}	;
text	{caption	=	"PIJN"	;	description	=	"	PIJN	"	;}	;
text	{caption	=	"STEM"	;	description	=	"	STEM	"	;}	;
text	{caption	=	"GAST"	;	description	=	"	GAST	"	;}	;
text	{caption	=	"LIED"	;	description	=	"	LIED	"	;}	;
text	{caption	=	"ZORG"	;	description	=	"	ZORG	"	;}	;
text	{caption	=	"ARME"	;	description	=	"	ARME	"	;}	;
text	{caption	=	"FLES"	;	description	=	"	FLES	"	;}	;
text	{caption	=	"ACHT"	;	description	=	"	ACHT	"	;}	;
text	{caption	=	"MOND"	;	description	=	"	MOND	"	;}	;
text	{caption	=	"RING"	;	description	=	"	RING	"	;}	;
text	{caption	=	"GRAS"	;	description	=	"	GRAS	"	;}	;
text	{caption	=	"MELK"	;	description	=	"	MELK	"	;}	;
text	{caption	=	"DOCH"	;	description	=	"	DOCH	"	;}	;
text	{caption	=	"BANG"	;	description	=	"	BANG	"	;}	;
text	{caption	=	"TONG"	;	description	=	"	TONG	"	;}	;
text	{caption	=	"ONZE"	;	description	=	"	ONZE	"	;}	;
text	{caption	=	"OPEN"	;	description	=	"	OPEN	"	;}	;
text	{caption	=	"JURK"	;	description	=	"	JURK	"	;}	;
text	{caption	=	"TRAP"	;	description	=	"	TRAP	"	;}	;
text	{caption	=	"ZAND"	;	description	=	"	ZAND	"	;}	;
text	{caption	=	"STAD"	;	description	=	"	STAD	"	;}	;
text	{caption	=	"SLOT"	;	description	=	"	SLOT	"	;}	;
text	{caption	=	"PLUS"	;	description	=	"	PLUS	"	;}	;
text	{caption	=	"FASE"	;	description	=	"	FASE	"	;}	;
text	{caption	=	"BLAD"	;	description	=	"	BLAD	"	;}	;
text	{caption	=	"CHEF"	;	description	=	"	CHEF	"	;}	;
text	{caption	=	"RIJK"	;	description	=	"	RIJK	"	;}	;
text	{caption	=	"EIND"	;	description	=	"	EIND	"	;}	;
text	{caption	=	"CAFE"	;	description	=	"	CAFE	"	;}	;
text	{caption	=	"MOED"	;	description	=	"	MOED	"	;}	;
text	{caption	=	"HALF"	;	description	=	"	HALF	"	;}	;
text	{caption	=	"PERS"	;	description	=	"	PERS	"	;}	;
text	{caption	=	"LEUK"	;	description	=	"	LEUK	"	;}	;
text	{caption	=	"ERIN"	;	description	=	"	ERIN	"	;}	;
text	{caption	=	"VALT"	;	description	=	"	VALT	"	;}	;
text	{caption	=	"OLIE"	;	description	=	"	OLIE	"	;}	;
text	{caption	=	"AUTO"	;	description	=	"	AUTO	"	;}	;
text	{caption	=	"NAUW"	;	description	=	"	NAUW	"	;}	;
text	{caption	=	"AARD"	;	description	=	"	AARD	"	;}	;
text	{caption	=	"JUNI"	;	description	=	"	JUNI	"	;}	;
text	{caption	=	"SOMS"	;	description	=	"	SOMS	"	;}	;
text	{caption	=	"GEUR"	;	description	=	"	GEUR	"	;}	;
text	{caption	=	"LAST"	;	description	=	"	LAST	"	;}	;
text	{caption	=	"IETS"	;	description	=	"	IETS	"	;}	;
text	{caption	=	"DIER"	;	description	=	"	DIER	"	;}	;
text	{caption	=	"KOUD"	;	description	=	"	KOUD	"	;}	;
text	{caption	=	"SPEL"	;	description	=	"	SPEL	"	;}	;
text	{caption	=	"MEID"	;	description	=	"	MEID	"	;}	;
text	{caption	=	"WILD"	;	description	=	"	WILD	"	;}	;
text	{caption	=	"ZIEK"	;	description	=	"	ZIEK	"	;}	;
text	{caption	=	"BEST"	;	description	=	"	BEST	"	;}	;
text	{caption	=	"LUID"	;	description	=	"	LUID	"	;}	;
text	{caption	=	"HAND"	;	description	=	"	HAND	"	;}	;
text	{caption	=	"HOGE"	;	description	=	"	HOGE	"	;}	;
text	{caption	=	"MATE"	;	description	=	"	MATE	"	;}	;
text	{caption	=	"ZELF"	;	description	=	"	ZELF	"	;}	;
text	{caption	=	"GAUW"	;	description	=	"	GAUW	"	;}	;
text	{caption	=	"ELKE"	;	description	=	"	ELKE	"	;}	;
text	{caption	=	"WIER"	;	description	=	"	WIER	"	;}	;
text	{caption	=	"ZOEK"	;	description	=	"	ZOEK	"	;}	;
text	{caption	=	"FIJN"	;	description	=	"	FIJN	"	;}	;
text	{caption	=	"FLAT"	;	description	=	"	FLAT	"	;}	;
text	{caption	=	"WERK"	;	description	=	"	WERK	"	;}	;
text	{caption	=	"KAMP"	;	description	=	"	KAMP	"	;}	;
text	{caption	=	"TYPE"	;	description	=	"	TYPE	"	;}	;
text	{caption	=	"LOOP"	;	description	=	"	LOOP	"	;}	;
text	{caption	=	"SOEP"	;	description	=	"	SOEP	"	;}	;
text	{caption	=	"HALS"	;	description	=	"	HALS	"	;}	;
text	{caption	=	"RODE"	;	description	=	"	RODE	"	;}	;
text	{caption	=	"OOIT"	;	description	=	"	OOIT	"	;}	;
text	{caption	=	"NEUS"	;	description	=	"	NEUS	"	;}	;
text	{caption	=	"MOOI"	;	description	=	"	MOOI	"	;}	;
text	{caption	=	"THEE"	;	description	=	"	THEE	"	;}	;
text	{caption	=	"RUST"	;	description	=	"	RUST	"	;}	;
text	{caption	=	"ROZE"	;	description	=	"	ROZE	"	;}	;
text	{caption	=	"DORP"	;	description	=	"	DORP	"	;}	;
text	{caption	=	"KENT"	;	description	=	"	KENT	"	;}	;
text	{caption	=	"HOEK"	;	description	=	"	HOEK	"	;}	;
text	{caption	=	"BLIJ"	;	description	=	"	BLIJ	"	;}	;
text	{caption	=	"RIEP"	;	description	=	"	RIEP	"	;}	;
text	{caption	=	"WARM"	;	description	=	"	WARM	"	;}	;
text	{caption	=	"PAUS"	;	description	=	"	PAUS	"	;}	;
text	{caption	=	"JONG"	;	description	=	"	JONG	"	;}	;
text	{caption	=	"JAAR"	;	description	=	"	JAAR	"	;}	;
text	{caption	=	"JOUW"	;	description	=	"	JOUW	"	;}	;
text	{caption	=	"OREN"	;	description	=	"	OREN	"	;}	;
text	{caption	=	"FEIT"	;	description	=	"	FEIT	"	;}	;
text	{caption	=	"BANK"	;	description	=	"	BANK	"	;}	;
text	{caption	=	"PLEK"	;	description	=	"	PLEK	"	;}	;
text	{caption	=	"TAXI"	;	description	=	"	TAXI	"	;}	;
text	{caption	=	"LAGE"	;	description	=	"	LAGE	"	;}	;
text	{caption	=	"DEUR"	;	description	=	"	DEUR	"	;}	;
text	{caption	=	"KUST"	;	description	=	"	KUST	"	;}	;
text	{caption	=	"FOUT"	;	description	=	"	FOUT	"	;}	;
text	{caption	=	"BIER"	;	description	=	"	BIER	"	;}	;
text	{caption	=	"NIET"	;	description	=	"	NIET	"	;}	;
text	{caption	=	"KEUS"	;	description	=	"	KEUS	"	;}	;
text	{caption	=	"EVEN"	;	description	=	"	EVEN	"	;}	;
text	{caption	=	"PLAT"	;	description	=	"	PLAT	"	;}	;
text	{caption	=	"NOCH"	;	description	=	"	NOCH	"	;}	;
text	{caption	=	"KLAP"	;	description	=	"	KLAP	"	;}	;
text	{caption	=	"IDEE"	;	description	=	"	IDEE	"	;}	;
text	{caption	=	"GIDS"	;	description	=	"	GIDS	"	;}	;
text	{caption	=	"OUWE"	;	description	=	"	OUWE	"	;}	;
text	{caption	=	"HEBT"	;	description	=	"	HEBT	"	;}	;
text	{caption	=	"CLUB"	;	description	=	"	CLUB	"	;}	;
text	{caption	=	"PUNT"	;	description	=	"	PUNT	"	;}	;
text	{caption	=	"ARTS"	;	description	=	"	ARTS	"	;}	;
text	{caption	=	"WELK"	;	description	=	"	WELK	"	;}	;
text	{caption	=	"RAND"	;	description	=	"	RAND	"	;}	;
text	{caption	=	"GELD"	;	description	=	"	GELD	"	;}	;
text	{caption	=	"VIJF"	;	description	=	"	VIJF	"	;}	;
text	{caption	=	"FILM"	;	description	=	"	FILM	"	;}	;
text	{caption	=	"MIJN"	;	description	=	"	MIJN	"	;}	;
text	{caption	=	"NIKS"	;	description	=	"	NIKS	"	;}	;
text	{caption	=	"LIJN"	;	description	=	"	LIJN	"	;}	;
text	{caption	=	"DRIE"	;	description	=	"	DRIE	"	;}	;
text	{caption	=	"NEST"	;	description	=	"	NEST	"	;}	;
text	{caption	=	"VOEL"	;	description	=	"	VOEL	"	;}	;
text	{caption	=	"ADEM"	;	description	=	"	ADEM	"	;}	;
} dutch;

array{		# 144
text	{caption	=	"TIEN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TIEN	"	;}	;
text	{caption	=	"ECHT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ECHT	"	;}	;
text	{caption	=	"ENIG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ENIG	"	;}	;
text	{caption	=	"OVER"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OVER	"	;}	;
text	{caption	=	"STOF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	STOF	"	;}	;
text	{caption	=	"LUST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LUST	"	;}	;
text	{caption	=	"DANK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DANK	"	;}	;
text	{caption	=	"VORM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VORM	"	;}	;
text	{caption	=	"NAME"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NAME	"	;}	;
text	{caption	=	"UREN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	UREN	"	;}	;
text	{caption	=	"BOEK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BOEK	"	;}	;
text	{caption	=	"VELD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VELD	"	;}	;
text	{caption	=	"WANG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WANG	"	;}	;
text	{caption	=	"ZULT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZULT	"	;}	;
text	{caption	=	"KANS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KANS	"	;}	;
text	{caption	=	"ETEN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ETEN	"	;}	;
text	{caption	=	"ALLE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ALLE	"	;}	;
text	{caption	=	"GOLF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GOLF	"	;}	;
text	{caption	=	"REIS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	REIS	"	;}	;
text	{caption	=	"DOEN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DOEN	"	;}	;
text	{caption	=	"VLUG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VLUG	"	;}	;
text	{caption	=	"HUID"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HUID	"	;}	;
text	{caption	=	"HEMD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HEMD	"	;}	;
text	{caption	=	"TERM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TERM	"	;}	;
text	{caption	=	"PIJN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PIJN	"	;}	;
text	{caption	=	"STEM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	STEM	"	;}	;
text	{caption	=	"GAST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GAST	"	;}	;
text	{caption	=	"LIED"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LIED	"	;}	;
text	{caption	=	"ZORG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZORG	"	;}	;
text	{caption	=	"ARME"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ARME	"	;}	;
text	{caption	=	"FLES"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FLES	"	;}	;
text	{caption	=	"ACHT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ACHT	"	;}	;
text	{caption	=	"MOND"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MOND	"	;}	;
text	{caption	=	"RING"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RING	"	;}	;
text	{caption	=	"GRAS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GRAS	"	;}	;
text	{caption	=	"MELK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MELK	"	;}	;
text	{caption	=	"DOCH"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DOCH	"	;}	;
text	{caption	=	"BANG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BANG	"	;}	;
text	{caption	=	"TONG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TONG	"	;}	;
text	{caption	=	"ONZE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ONZE	"	;}	;
text	{caption	=	"OPEN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OPEN	"	;}	;
text	{caption	=	"JURK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	JURK	"	;}	;
text	{caption	=	"TRAP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TRAP	"	;}	;
text	{caption	=	"ZAND"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZAND	"	;}	;
text	{caption	=	"STAD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	STAD	"	;}	;
text	{caption	=	"SLOT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	SLOT	"	;}	;
text	{caption	=	"PLUS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PLUS	"	;}	;
text	{caption	=	"FASE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FASE	"	;}	;
text	{caption	=	"BLAD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BLAD	"	;}	;
text	{caption	=	"CHEF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	CHEF	"	;}	;
text	{caption	=	"RIJK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RIJK	"	;}	;
text	{caption	=	"EIND"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	EIND	"	;}	;
text	{caption	=	"CAFE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	CAFE	"	;}	;
text	{caption	=	"MOED"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MOED	"	;}	;
text	{caption	=	"HALF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HALF	"	;}	;
text	{caption	=	"PERS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PERS	"	;}	;
text	{caption	=	"LEUK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LEUK	"	;}	;
text	{caption	=	"ERIN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ERIN	"	;}	;
text	{caption	=	"VALT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VALT	"	;}	;
text	{caption	=	"OLIE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OLIE	"	;}	;
text	{caption	=	"AUTO"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	AUTO	"	;}	;
text	{caption	=	"NAUW"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NAUW	"	;}	;
text	{caption	=	"AARD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	AARD	"	;}	;
text	{caption	=	"JUNI"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	JUNI	"	;}	;
text	{caption	=	"SOMS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	SOMS	"	;}	;
text	{caption	=	"GEUR"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GEUR	"	;}	;
text	{caption	=	"LAST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LAST	"	;}	;
text	{caption	=	"IETS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	IETS	"	;}	;
text	{caption	=	"DIER"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DIER	"	;}	;
text	{caption	=	"KOUD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KOUD	"	;}	;
text	{caption	=	"SPEL"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	SPEL	"	;}	;
text	{caption	=	"MEID"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MEID	"	;}	;
text	{caption	=	"WILD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WILD	"	;}	;
text	{caption	=	"ZIEK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZIEK	"	;}	;
text	{caption	=	"BEST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BEST	"	;}	;
text	{caption	=	"LUID"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LUID	"	;}	;
text	{caption	=	"HAND"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HAND	"	;}	;
text	{caption	=	"HOGE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HOGE	"	;}	;
text	{caption	=	"MATE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MATE	"	;}	;
text	{caption	=	"ZELF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZELF	"	;}	;
text	{caption	=	"GAUW"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GAUW	"	;}	;
text	{caption	=	"ELKE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ELKE	"	;}	;
text	{caption	=	"WIER"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WIER	"	;}	;
text	{caption	=	"ZOEK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ZOEK	"	;}	;
text	{caption	=	"FIJN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FIJN	"	;}	;
text	{caption	=	"FLAT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FLAT	"	;}	;
text	{caption	=	"WERK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WERK	"	;}	;
text	{caption	=	"KAMP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KAMP	"	;}	;
text	{caption	=	"TYPE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TYPE	"	;}	;
text	{caption	=	"LOOP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LOOP	"	;}	;
text	{caption	=	"SOEP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	SOEP	"	;}	;
text	{caption	=	"HALS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HALS	"	;}	;
text	{caption	=	"RODE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RODE	"	;}	;
text	{caption	=	"OOIT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OOIT	"	;}	;
text	{caption	=	"NEUS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NEUS	"	;}	;
text	{caption	=	"MOOI"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MOOI	"	;}	;
text	{caption	=	"THEE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	THEE	"	;}	;
text	{caption	=	"RUST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RUST	"	;}	;
text	{caption	=	"ROZE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ROZE	"	;}	;
text	{caption	=	"DORP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DORP	"	;}	;
text	{caption	=	"KENT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KENT	"	;}	;
text	{caption	=	"HOEK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HOEK	"	;}	;
text	{caption	=	"BLIJ"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BLIJ	"	;}	;
text	{caption	=	"RIEP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RIEP	"	;}	;
text	{caption	=	"WARM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WARM	"	;}	;
text	{caption	=	"PAUS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PAUS	"	;}	;
text	{caption	=	"JONG"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	JONG	"	;}	;
text	{caption	=	"JAAR"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	JAAR	"	;}	;
text	{caption	=	"JOUW"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	JOUW	"	;}	;
text	{caption	=	"OREN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OREN	"	;}	;
text	{caption	=	"FEIT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FEIT	"	;}	;
text	{caption	=	"BANK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BANK	"	;}	;
text	{caption	=	"PLEK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PLEK	"	;}	;
text	{caption	=	"TAXI"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	TAXI	"	;}	;
text	{caption	=	"LAGE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LAGE	"	;}	;
text	{caption	=	"DEUR"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DEUR	"	;}	;
text	{caption	=	"KUST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KUST	"	;}	;
text	{caption	=	"FOUT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FOUT	"	;}	;
text	{caption	=	"BIER"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	BIER	"	;}	;
text	{caption	=	"NIET"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NIET	"	;}	;
text	{caption	=	"KEUS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KEUS	"	;}	;
text	{caption	=	"EVEN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	EVEN	"	;}	;
text	{caption	=	"PLAT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PLAT	"	;}	;
text	{caption	=	"NOCH"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NOCH	"	;}	;
text	{caption	=	"KLAP"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	KLAP	"	;}	;
text	{caption	=	"IDEE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	IDEE	"	;}	;
text	{caption	=	"GIDS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GIDS	"	;}	;
text	{caption	=	"OUWE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	OUWE	"	;}	;
text	{caption	=	"HEBT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	HEBT	"	;}	;
text	{caption	=	"CLUB"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	CLUB	"	;}	;
text	{caption	=	"PUNT"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	PUNT	"	;}	;
text	{caption	=	"ARTS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ARTS	"	;}	;
text	{caption	=	"WELK"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	WELK	"	;}	;
text	{caption	=	"RAND"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	RAND	"	;}	;
text	{caption	=	"GELD"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	GELD	"	;}	;
text	{caption	=	"VIJF"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VIJF	"	;}	;
text	{caption	=	"FILM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	FILM	"	;}	;
text	{caption	=	"MIJN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	MIJN	"	;}	;
text	{caption	=	"NIKS"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NIKS	"	;}	;
text	{caption	=	"LIJN"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	LIJN	"	;}	;
text	{caption	=	"DRIE"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	DRIE	"	;}	;
text	{caption	=	"NEST"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	NEST	"	;}	;
text	{caption	=	"VOEL"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	VOEL	"	;}	;
text	{caption	=	"ADEM"	;	font_size = 35;	font=	"Hanzi Kaishu";	description	=	"	ADEM	"	;}	;
} chinese;

array{
text {caption = "+"; font_color= 0,0,0; font_size = 30; font = "Times New Roman"; description = "rest1";} ;
} rest;

#Instructions for participants
picture { text {caption = "The experiment will start at any moment.
Make sure that you stay still.

Look at the middle of the screen while the words appear.

There will be periods when no words appear.
please keep looking at the screen during this time.

You do not have to push any buttons.";
font_color = 0,0,0; font_size = 24; font = "Times New Roman";
}; x = 0; y = 0; } startTrialPicture;

# Blank and fixation screens
picture {background_color = 255,255,255;} white_screen;
picture {text {caption = "+"; font_color= 0,0,0; font_size=30; font = "Times New Roman";} fix_text; x = 0; y = 0; }  pic_fix;

# Placeholder for variables
bitmap {filename = "red.bmp";  description = "placeholder"; } placeholder;

############ Start fMRI Trial ####################
trial {
   picture startTrialPicture;
   time = 0;
   duration = next_picture;
   picture startTrialPicture;
   mri_pulse = 1;
   duration = 1000;
} startTrial;

################# Button Trial ################################
trial {
		all_responses = false;	           # Does not log all responses, only those during active events #
		trial_type = fixed;

	stimulus_event {
					picture white_screen;
					time = 0;
					duration = 245;
					code = "isi_blank";
					response_active = false;
					}isi_blank;

	stimulus_event {
					picture pic_fix;
					deltat = 245;
					duration = 245;
					code = "isi_fix";
					response_active = false;
					}isi_fix;

	stimulus_event {
					picture {
						bitmap placeholder;
						x = 0; y = 0;
					} word_stim;
					deltat = 245;
					duration = 495;
					code = "word";
					response_active = false;
					}word_event;

} word_trial;

################# Baseline ################################
trial {
		all_responses = false;	           # Does not log all responses, only those during active events #
		trial_type = fixed;

	stimulus_event {
					picture {
						bitmap placeholder;
						x = 0; y = 0;
					} rest_stim;
					time = 0;
					duration = 15995;
					code = "rest";
					response_active = false;
					}rest_event;

} rest_trial;

################################## START PCL ####################################

begin_pcl;

############# DECLARATIONS ##############

int start_time = clock.time();

string subnr = logfile.subject();
output_file output = new output_file;
output.open( "VWFA_Localizer_16s_" + subnr + "_output.txt" );
output.print(start_time);output.print("\n");

string word = "";
int isi = 0;
int j = 1;
int k = 1;
int m = 1;
int c = 1;
int r = 1;

string baseline = "0";
string nederlands = "1";
string china = "2";

###############################################################################

### START OF THE TRIALS LOOPS ###

###################
sub condition1 begin

output.print( "block\ttrialnr\tword\n" );

int trial_number = 1;

#dutch.shuffle();

loop j = 1 until j > 16  begin;

		word_stim.set_part( 1, dutch[k] );

		word = dutch[k].description();

		word_event.set_event_code(nederlands);

		word_trial.present();

		output.print("dutch");output.print("\t");
		output.print(trial_number);output.print("\t");
		output.print(word);output.print("\n");

		trial_number = trial_number + 1;

		k = k + 1;

		j = j + 1;
		end;

	# Baseline block

		rest_event.set_event_code(baseline);

		rest_stim.set_part( 1, rest[1] );
		rest_trial.present();

end;

###################
sub condition2 begin

output.print( "block\ttrialnr\tword\n" );

int trial_number = 1;

#chinese.shuffle();

loop j = 1 until j > 16  begin;

		word_stim.set_part( 1, chinese[c] );

		word = chinese[c].description();

		word_event.set_event_code(china);

		word_trial.present();

		output.print("chinese");output.print("\t");
		output.print(trial_number);output.print("\t");
		output.print(word);output.print("\n");

		trial_number = trial_number + 1;

		c = c + 1;

		j = j + 1;
		end;

	# Baseline block

		rest_event.set_event_code(baseline);

		rest_stim.set_part( 1, rest[1] );
		rest_trial.present();

end;

######### Define subject conditions
preset int subjectCondition = 1;

array <int> conditions [18] =
{1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2};

if subjectCondition == 1 then

		dutch.shuffle();
		chinese.shuffle();

		startTrial.present();

		# Begin with rest - Baseline block

		rest_event.set_event_code(baseline);
		rest_event.set_duration(17995);

		rest_stim.set_part( 1, rest[1] );
		rest_trial.present();

		loop k = 1 until k > dutch.count() begin;
		loop c = 1 until c > chinese.count() begin;

		loop r = 1 until r > conditions.count() begin;
		# 32 seconds each * 18 = 576 s = 9.6 minutes

			if conditions[r] == 1
			then condition1();
			elseif conditions[r] == 2
			then condition2();
			end;

		r=r+1;

		end;

		end;
		end;

		int end_time = clock.time();
		output.print(end_time);output.print("\n");

end;


CWS-TOOLING: integrate CWS sb120

CWS-TOOLING: integrate CWS sb120

-o sd.AccessibleDrawDocumentView
#i111199 -o sd.AccessibleOutlineView
#i35935# -o sd.AccessibleSlideView
#i111042# -o sd.DrawController_DrawView
#i111042# -o sd.DrawController_HandoutView
#i111042# -o sd.DrawController_NotesView
#i111043# -o sd.DrawController_OutlineView
#i111042# -o sd.DrawController_PresentationView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdDrawPagesAccess
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
#i111329 -o sd.SdXCustomPresentationAccess
#i84994# -o sd.SdXImpressDocument
-o sd.SdXPresentation
#i87746 -o sd.SdXShape

-o sd.AccessibleDrawDocumentView
-o sd.AccessibleOutlineView
#i35935# -o sd.AccessibleSlideView
-o sd.DrawController_DrawView
-o sd.DrawController_HandoutView
-o sd.DrawController_NotesView
-o sd.DrawController_OutlineView
-o sd.DrawController_PresentationView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdDrawPagesAccess
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXCustomPresentationAccess
#i84994# -o sd.SdXImpressDocument
-o sd.SdXPresentation
#i87746 -o sd.SdXShape


sb120: #i111329# disabled failing tests for now

-o sd.AccessibleDrawDocumentView
#i111199 -o sd.AccessibleOutlineView
#i35935# -o sd.AccessibleSlideView
#i111042# -o sd.DrawController_DrawView
#i111042# -o sd.DrawController_HandoutView
#i111042# -o sd.DrawController_NotesView
#i111043# -o sd.DrawController_OutlineView
#i111042# -o sd.DrawController_PresentationView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdDrawPagesAccess
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXCustomPresentationAccess
#i84994# -o sd.SdXImpressDocument
-o sd.SdXPresentation
#i87746 -o sd.SdXShape


INTEGRATION: CWS unoapi1 (1.7.108); FILE MERGED 2007/08/15 09:44:09 cn 1.7.108.1: #i79479# update lists

# -o sd.SdXImpressDocument
# -o sd.SdXCustomPresentationAccess
###i35935### -o sd.AccessibleDrawDocumentView
# -o sd.AccessibleOutlineView
###i35935### -o sd.AccessibleSlideView
# -o sd.SdDocLinkTargets
# -o sd.SdDrawPage
# -o sd.SdGenericDrawPage
# -o sd.SdLayer
# -o sd.SdLayerManager
# -o sd.SdMasterPage
# -o sd.SdMasterPagesAccess
# -o sd.SdPageLinkTargets
# -o sd.SdXCustomPresentation
# -o sd.SdXPresentation
# -o sd.SdXShape
# -o sd.SdDrawPagesAccess
# -o sd.DrawController_DrawView
# -o sd.DrawController_HandoutView
# -o sd.DrawController_NotesView
# -o sd.DrawController_OutlineView
# -o sd.DrawController_PresentationView

-o sd.AccessibleDrawDocumentView
-o sd.AccessibleOutlineView
#-o sd.AccessibleSlideView
-o sd.DrawController_DrawView
-o sd.DrawController_HandoutView
-o sd.DrawController_NotesView
-o sd.DrawController_OutlineView
-o sd.DrawController_PresentationView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdDrawPagesAccess
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXCustomPresentationAccess
#-o sd.SdXImpressDocument
-o sd.SdXPresentation
-o sd.SdXShape

-o sd.SdXImpressDocument
-o sd.SdXCustomPresentationAccess
###i35935### -o sd.AccessibleDrawDocumentView
-o sd.AccessibleOutlineView
###i35935### -o sd.AccessibleSlideView
-o sd.SdDocLinkTargets
-o sd.SdDrawPage
-o sd.SdGenericDrawPage
-o sd.SdLayer
-o sd.SdLayerManager
-o sd.SdMasterPage
-o sd.SdMasterPagesAccess
-o sd.SdPageLinkTargets
-o sd.SdXCustomPresentation
-o sd.SdXPresentation
-o sd.SdXShape
-o sd.SdDrawPagesAccess
-o sd.DrawController_DrawView
-o sd.DrawController_HandoutView
-o sd.DrawController_NotesView
-o sd.DrawController_OutlineView
-o sd.DrawController_PresentationView


Change info when model has finished execution to more acurate

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then
                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mlink_set_obj(connection_id, 'model_stop_flag', 1 );
                    mlink_set_obj(connection_id, 'terminate_signal_task', 1 );
                    disp('### Model execution has been finished');
                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            // TODO: Fix result number, change if statement to  result > -1
                            if result > -3 then
                                if %microdaq.private.mdaq_hwid(4) == 0 then
                                    cpu_clock = 300000000;
                                else
                                    cpu_clock = 456000000;
                                end
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                            dsp_exec_profile.end = profile_data(2);
                            save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                            clear dsp_exec_profile;
                            disp('### Profiling data have been downloaded.');
                        end
                    end

                    // make scope nicer
                    list_fig=winsid();
                    for i=1:length(list_fig)
                        h=get_figure_handle(list_fig(i));
                        if h.children.type == "Axes" then
                            axes = h.children;
                            axes.grid = [1,1];
                            axes.grid_style = [9,10];
                            poliline = axes.children;
                            if isempty(poliline.children) then
                                poliline.polyline_style = 2;
                            end
                        end
                    end
                end
                mdaq_close(connection_id);
            end
        end
    end
end

if %microdaq.private.connection_id > -1 & (%microdaq.private.has_mdaq_param_sim | %microdaq.private.has_mdaq_block) then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_param_sim = %F;
end

endfunction

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then
                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mlink_set_obj(connection_id, 'model_stop_flag', 1 );
                    mlink_set_obj(connection_id, 'terminate_signal_task', 1 );
                    disp('### Model execution terminated');
                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            // TODO: Fix result number, change if statement to  result > -1
                            if result > -3 then
                                if %microdaq.private.mdaq_hwid(4) == 0 then
                                    cpu_clock = 300000000;
                                else
                                    cpu_clock = 456000000;
                                end
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                            dsp_exec_profile.end = profile_data(2);
                            save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                            clear dsp_exec_profile;
                            disp('### Profiling data have been downloaded.');
                        end
                    end

                    // make scope nicer
                    list_fig=winsid();
                    for i=1:length(list_fig)
                        h=get_figure_handle(list_fig(i));
                        if h.children.type == "Axes" then
                            axes = h.children;
                            axes.grid = [1,1];
                            axes.grid_style = [9,10];
                            poliline = axes.children;
                            if isempty(poliline.children) then
                                poliline.polyline_style = 2;
                            end
                        end
                    end
                end
                mdaq_close(connection_id);
            end
        end
    end
end

if %microdaq.private.connection_id > -1 & (%microdaq.private.has_mdaq_param_sim | %microdaq.private.has_mdaq_block) then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_param_sim = %F;
end

endfunction


MSC-273: Connection successful message displayed even if connection fails

function jobs = PAconnect(uri,credpath)

    global ('PA_initialized', 'PA_connected','PA_solver', 'PA_scheduler_URI')
    jobs = [];
    initJavaStack();
    if ~exists('PA_initialized') | PA_initialized ~= 1
        PAinit();
        jimport java.lang.System;
        jimport org.scilab.modules.gui.utils.ScilabPrintStream;
        if jinvoke(ScilabPrintStream,'isAvailable') then
            inst = jinvoke(ScilabPrintStream,'getInstance');
            addJavaObj(inst);
            jinvoke(System, 'setOut',inst);
            jinvoke(ScilabPrintStream,'setRedirect',[]);
        end
    end
    opt=PAoptions();

    if type(PA_solver) ~= 1 then
        isJVMdeployed = 1;
        isConnected = 0;
        try
            isConnected = jinvoke(PA_solver,'isConnected');
        catch
            isJVMdeployed = 0;
        end
    else
        isJVMdeployed = 0;
        isConnected = 0;
    end
    if ~exists('uri')
        uri = [];
    end
    if ~isempty(PA_scheduler_URI) & ~isempty(uri)  & PA_scheduler_URI ~= uri then
        // particular case when the scheduler uri changes, we redeploy everything
        isJVMdeployed = 0;
        isConnected = 0;
    else
        PA_scheduler_URI = uri;
    end

    if ~isJVMdeployed
        deployJVM(opt,uri);
    end
    if ~isConnected then
        ok = jinvoke(PA_solver,'join', uri);
        if ~ok then
            logPath = jinvoke(PA_solver,'getLogFilePath');
            error('PAConnect::Error wile connecting to ' + uri +', detailed error message has been logged to ' + logPath);
        end
        jobs = dataspaces(opt);
        disp(strcat(['Connection successful to ', uri]));
    end

    if ~jinvoke(PA_solver,'isLoggedIn')
        if argn(2) == 2 then
            login(uri,credpath);
        else
            login(uri);
        end
        PA_connected = 1;
    else
        disp('Already connected');
    end
    //jremove(ScilabSolver);
    clearJavaStack();
endfunction

function deployJVM(opt,uri)
    global ('PA_matsci_dir','PA_solver', 'PA_dsregistry', 'PA_jvminterface')
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.util.ScilabJVMSpawnHelper;
    jimport java.lang.String;
    deployer = jinvoke(ScilabJVMSpawnHelper,'getInstance');
    addJavaObj(String);
    addJavaObj(ScilabJVMSpawnHelper);
    addJavaObj(deployer);

    home = getenv('JAVA_HOME',jre_path());  // this uses the JAVA_HOME env var or the jre used by scilab

    fs=filesep();
    if length(home) > 0
        if (getos() == "Windows") then
            jinvoke(deployer,'setJavaPath',home + fs + 'bin'+ fs +'java.exe');
        else
            jinvoke(deployer,'setJavaPath',home + fs + 'bin'+ fs +'java');
        end

    end

    matsci_dir = opt.MatSciDir;

    middleman_lib_dir = opt.MiddlemanJarsDir;
    if ~isdir(middleman_lib_dir) then
        error('PAconnect::cannot find directory defined in option MiddlemanJarsDir : ' + middleman_lib_dir);
    end

    fs=filesep();
    jarfiles = listfiles(middleman_lib_dir+fs+'*.jar');

    jarsjava = jarray('java.lang.String', size(jarfiles,1));
    addJavaObj(jarsjava);
    for i=1:size(jarfiles,1)
        jartmp = jnewInstance(String, jarfiles(i));
        jarsjava(i-1) = jartmp;
        addJavaObj(jartmp);
    end
    options = opt.JvmArguments;
    for i=1:size(options,1)
         jinvoke(deployer,'addJvmOption',options(i).entries);
    end
    jinvoke(deployer,'setSchedulerURI', uri);
    jinvoke(deployer,'setMatSciDir', matsci_dir);
    jinvoke(deployer,'setDebug',opt.Debug);
    jinvoke(deployer,'setClasspathEntries',jarsjava);
    jinvoke(deployer,'setProActiveConfiguration',opt.ProActiveConfiguration);
    jinvoke(deployer,'setLog4JFile',opt.Log4JConfiguration);
    jinvoke(deployer,'setPolicyFile',opt.SecurityFile);
    jinvoke(deployer,'setClassName','org.ow2.proactive.scheduler.ext.scilab.middleman.ScilabMiddlemanDeployer');

    rmiport = opt.RmiPort;

    jinvoke(deployer,'setRmiPort',rmiport);

    pair = jinvoke(deployer,'deployOrLookup');
    itfs = jinvoke(pair,'getX');
    port = jinvoke(pair,'getY');
    PAoptions('RmiPort',port);
    PA_solver = jinvoke(deployer,'getScilabEnvironment');

    PA_dsregistry = jinvoke(deployer,'getDSRegistry');

    PA_jvminterface = jinvoke(deployer,'getJvmInterface');

    disp('Connection to the middleman JVM has succeeded, now trying to connect to the scheduler');
endfunction

function login(uri,credpath)
    global ('PA_solver')
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.util.ScilabJVMSpawnHelper;
    // Logging in
    if ~jinvoke(PA_solver,'isLoggedIn') then

        if argn(2) == 2
            try
                jinvoke(PA_solver,'login',credpath);
            catch
                clearJavaStack();
                disp(lasterror());
                error('PAconnect::Authentication error');
            end
        elseif isempty(uri) & jinvoke(PA_solver,'hasCredentialsStored');
             try
                jinvoke(PA_solver,'login',[], [], []);
            catch
                clearJavaStack();
                disp(lasterror());
                error('PAconnect::Authentication error');
            end
        else
            disp('Please enter login/password');
            deployer = jinvoke(ScilabJVMSpawnHelper,'getInstance');
            addJavaObj(deployer);
            jinvoke(deployer,'startLoginGUI');
            while ~jinvoke(PA_solver,'isLoggedIn') & jinvoke(deployer,'getNbAttempts') <= 3
                xpause(1000*100);
            end
            if jinvoke(deployer,'getNbAttempts')  > 3 then
                clearJavaStack();
                error('PAconnect::Authentication error');
            end
        end
        disp('Login successful');
    end

endfunction

function jobs = dataspaces(opt)
    global ('PA_dsregistry')
    jinvoke(PA_dsregistry, 'init','ScilabInputSpace', 'ScilabOutputSpace', opt.Debug);
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.ScilabTaskRepository;
    repository = jinvoke(ScilabTaskRepository,'getInstance');
    notReceived = jinvoke(repository, 'notYetReceived');
    jobs = [];
    if ~jinvoke(notReceived, 'isEmpty')
          jobs = list();
          msg = 'The following jobs were uncomplete before last scilab shutdown : ';
          for j = 0:jinvoke(notReceived, 'size')-1
                  jid = jinvoke(notReceived, 'get', j);
                  msg = msg + ' ' + jid;
                  jobs(j+1) = jid;
          end
          disp(msg);
    end
    jremove(notReceived);
    jremove(repository);
    jremove(ScilabTaskRepository);
endfunction

function initJavaStack()
    global('JAVA_STACK')
    JAVA_STACK=list();
endfunction

function addJavaObj(obj)
    global('JAVA_STACK')
    JAVA_STACK($+1)=obj;
endfunction

function clearJavaStack()
    global('JAVA_STACK')
    for i=length(JAVA_STACK):-1:1
        try
            jremove(JAVA_STACK(i));
        catch
        end
    end
    clearglobal('JAVA_STACK');
endfunction

function jobs = PAconnect(uri,credpath)

    global ('PA_initialized', 'PA_connected','PA_solver', 'PA_scheduler_URI')
    jobs = [];
    initJavaStack();
    if ~exists('PA_initialized') | PA_initialized ~= 1
        PAinit();
        jimport java.lang.System;
        jimport org.scilab.modules.gui.utils.ScilabPrintStream;
        if jinvoke(ScilabPrintStream,'isAvailable') then
            inst = jinvoke(ScilabPrintStream,'getInstance');
            addJavaObj(inst);
            jinvoke(System, 'setOut',inst);
            jinvoke(ScilabPrintStream,'setRedirect',[]);
        end
    end
    opt=PAoptions();

    if type(PA_solver) ~= 1 then
        isJVMdeployed = 1;
        isConnected = 0;
        try
            isConnected = jinvoke(PA_solver,'isConnected');
        catch
            isJVMdeployed = 0;
        end
    else
        isJVMdeployed = 0;
        isConnected = 0;
    end
    if ~exists('uri')
        uri = [];
    end
    if ~isempty(PA_scheduler_URI) & ~isempty(uri)  & PA_scheduler_URI ~= uri then
        // particular case when the scheduler uri changes, we redeploy everything
        isJVMdeployed = 0;
        isConnected = 0;
    else
        PA_scheduler_URI = uri;
    end

    if ~isJVMdeployed
        deployJVM(opt,uri);
    end
    if ~isConnected then
        ok = jinvoke(PA_solver,'join', uri);
        if ~ok then
            logPath = jinvoke(PA_solver,'getLogFilePath');
            error('PAConnect::Error wile connecting to ' + uri +', detailed error message has been logged to ' + logPath);
        end
        jobs = dataspaces(opt);
        disp(strcat(['Connection successful to ', uri]));
    end

    if ~jinvoke(PA_solver,'isLoggedIn')
        if argn(2) == 2 then
            login(uri,credpath);
        else
            login(uri);
        end
        PA_connected = 1;
    else
        disp('Already connected');
    end
    //jremove(ScilabSolver);
    clearJavaStack();
endfunction

function deployJVM(opt,uri)
    global ('PA_matsci_dir','PA_solver', 'PA_dsregistry', 'PA_jvminterface')
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.util.ScilabJVMSpawnHelper;
    jimport java.lang.String;
    deployer = jinvoke(ScilabJVMSpawnHelper,'getInstance');
    addJavaObj(String);
    addJavaObj(ScilabJVMSpawnHelper);
    addJavaObj(deployer);

    home = getenv('JAVA_HOME',jre_path());  // this uses the JAVA_HOME env var or the jre used by scilab

    fs=filesep();
    if length(home) > 0
        if (getos() == "Windows") then
            jinvoke(deployer,'setJavaPath',home + fs + 'bin'+ fs +'java.exe');
        else
            jinvoke(deployer,'setJavaPath',home + fs + 'bin'+ fs +'java');
        end

    end

    matsci_dir = opt.MatSciDir;

    middleman_lib_dir = opt.MiddlemanJarsDir;
    if ~isdir(middleman_lib_dir) then
        error('PAconnect::cannot find directory defined in option MiddlemanJarsDir : ' + middleman_lib_dir);
    end

    fs=filesep();
    jarfiles = listfiles(middleman_lib_dir+fs+'*.jar');

    jarsjava = jarray('java.lang.String', size(jarfiles,1));
    addJavaObj(jarsjava);
    for i=1:size(jarfiles,1)
        jartmp = jnewInstance(String, jarfiles(i));
        jarsjava(i-1) = jartmp;
        addJavaObj(jartmp);
    end
    options = opt.JvmArguments;
    for i=1:size(options,1)
         jinvoke(deployer,'addJvmOption',options(i).entries);
    end
    jinvoke(deployer,'setSchedulerURI', uri);
    jinvoke(deployer,'setMatSciDir', matsci_dir);
    jinvoke(deployer,'setDebug',opt.Debug);
    jinvoke(deployer,'setClasspathEntries',jarsjava);
    jinvoke(deployer,'setProActiveConfiguration',opt.ProActiveConfiguration);
    jinvoke(deployer,'setLog4JFile',opt.Log4JConfiguration);
    jinvoke(deployer,'setPolicyFile',opt.SecurityFile);
    jinvoke(deployer,'setClassName','org.ow2.proactive.scheduler.ext.scilab.middleman.ScilabMiddlemanDeployer');

    rmiport = opt.RmiPort;

    jinvoke(deployer,'setRmiPort',rmiport);

    pair = jinvoke(deployer,'deployOrLookup');
    itfs = jinvoke(pair,'getX');
    port = jinvoke(pair,'getY');
    PAoptions('RmiPort',port);
    PA_solver = jinvoke(deployer,'getScilabEnvironment');

    PA_dsregistry = jinvoke(deployer,'getDSRegistry');

    PA_jvminterface = jinvoke(deployer,'getJvmInterface');

    disp('Connection to JVM successful');
endfunction

function login(uri,credpath)
    global ('PA_solver')
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.util.ScilabJVMSpawnHelper;
    // Logging in
    if ~jinvoke(PA_solver,'isLoggedIn') then

        if argn(2) == 2
            try
                jinvoke(PA_solver,'login',credpath);
            catch
                clearJavaStack();
                disp(lasterror());
                error('PAconnect::Authentication error');
            end
        elseif isempty(uri) & jinvoke(PA_solver,'hasCredentialsStored');
             try
                jinvoke(PA_solver,'login',[], [], []);
            catch
                clearJavaStack();
                disp(lasterror());
                error('PAconnect::Authentication error');
            end
        else
            disp('Please enter login/password');
            deployer = jinvoke(ScilabJVMSpawnHelper,'getInstance');
            addJavaObj(deployer);
            jinvoke(deployer,'startLoginGUI');
            while ~jinvoke(PA_solver,'isLoggedIn') & jinvoke(deployer,'getNbAttempts') <= 3
                xpause(1000*100);
            end
            if jinvoke(deployer,'getNbAttempts')  > 3 then
                clearJavaStack();
                error('PAconnect::Authentication error');
            end
        end
        disp('Login successful');
    end

endfunction

function jobs = dataspaces(opt)
    global ('PA_dsregistry')
    jinvoke(PA_dsregistry, 'init','ScilabInputSpace', 'ScilabOutputSpace', opt.Debug);
    jimport org.ow2.proactive.scheduler.ext.scilab.client.embedded.ScilabTaskRepository;
    repository = jinvoke(ScilabTaskRepository,'getInstance');
    notReceived = jinvoke(repository, 'notYetReceived');
    jobs = [];
    if ~jinvoke(notReceived, 'isEmpty')
          jobs = list();
          msg = 'The following jobs were uncomplete before last scilab shutdown : ';
          for j = 0:jinvoke(notReceived, 'size')-1
                  jid = jinvoke(notReceived, 'get', j);
                  msg = msg + ' ' + jid;
                  jobs(j+1) = jid;
          end
          disp(msg);
    end
    jremove(notReceived);
    jremove(repository);
    jremove(ScilabTaskRepository);
endfunction

function initJavaStack()
    global('JAVA_STACK')
    JAVA_STACK=list();
endfunction

function addJavaObj(obj)
    global('JAVA_STACK')
    JAVA_STACK($+1)=obj;
endfunction

function clearJavaStack()
    global('JAVA_STACK')
    for i=length(JAVA_STACK):-1:1
        try
            jremove(JAVA_STACK(i));
        catch
        end
    end
    clearglobal('JAVA_STACK');
endfunction


Read en write wav toegevoegd

Read en write wav toegevoegd

[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest2(anja).wav");
//[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest1(H-style).wav");

testsign = testsign(1,:);
t = [1:1:length(testsign)]*1/Fs;

[LD_coeff, amplitude, frequentie] = wfir('bp',100,[800/16000, 2000/16000],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

plot(t, testsign)
plot(t, LD_output, 'r');

wavwrite(LD_output, 'SCI/modules/sound/demos/'+'yolo.wav');

t = [0: 0.0000625: 0.02];
N = size(t, '*');
sin_100Hz = 2*sin(2*%pi*700*t);
sin_1000Hz = 2*sin(2*%pi*1000*t);
sin_5000Hz = 2*sin(2*%pi*5000*t);
testsign = sin_100Hz + sin_1000Hz + sin_5000Hz;
[LD_coeff, amplitude, frequentie] = wfir('bp',100,[800/16000, 2000/16000],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

Frequentie_FFT = abs(fft(testsign));
f = 16000 * (0:(N/2))/N;
n = size(f, '*');
figure;

subplot(311);
plot(f, Frequentie_FFT(1:n));
plot(frequentie*16000, amplitude*N, 'black');
subplot(312);
plot(t, LD_output, 'r');
subplot(313);
plot(t, testsign)
plot(t, LD_output, 'r');
plot(t, sin_5000Hz, 'g');


verbeterd

verbeterd

//binnenhalen van de WAV-file
[testsign,Fs,bits]=wavread("D:\Programs\scilab-5.5.2\modules\sound\demos\BART2.wav");

samplespeed = 44100;
delay = 1500; // choose the echo time of the sound (ms)
echotime = [delay/1000] * samplespeed;

//for loop voor de lengte van het audio-signaal
for n=1:length(testsign),
    if n <= echotime  then       //tijd wachten voor echo begint
        outputO = testsign(n); //buffer met origineel
        testsign(n)= outputO;
    elseif n > echotime then  //na bepaalde tijd start de echo

        //testsign gelijkstellen aan testsign + signaal van echotime sampeles terug
         testsign(n)=[testsign(n) + (testsign(n-echotime)*0.7 )];
end,

end
playsnd(testsign,samplespeed); //afspelen van het audio-signaal met echo

//binnenhalen van de WAV-file
[testsign,Fs,bits]=wavread("D:\Programs\scilab-5.5.2\modules\sound\demos\BART.wav");

//for loop voor de lengte van het audio-signaal
for n=1:length(testsign),
    if n <= 50000  then        //eerste 50.000 samples gewoon doorlaten
        outputO = testsign(n); //buffer met origineel
        testsign(n)= outputO;
    elseif n > 50000 then  //na 50.000 samples echo starten

        //testsign gelijkstellen aan testsign + signaal van 50.000 sampeles terug
         testsign(n)=[testsign(n) + (testsign(n-50000)*0.6 )];
end,

end
playsnd(testsign,44100); //afspelen van het audio-signaal met echo


Fix ADC block defaults

Fix ADC block defaults

function [x,y,typ] = mdaq_adc(job,arg1,arg2)
    global %microdaq;

    adc_desc = ["This block reads MicroDAQ analog inputs (AI). Block detects";
    "MicroDAQ analog inputs type and allows channel, range";
    "and measurement type selection.";
    "In order to select analog input channels scalar or vector";
    "containing channel number have to be provided.";
    "Input range can be selected by providing scalar or vector";
    "with range identifiers. If single range provided it will";
    "be applied for all selected channels."
    "Single-ended or differential measurement type can be selected.";
    "Scalar or vector with 1 and 0 values can be provided to enable";
    "and disable differential mode.";
    "If scalar is provided it will be applied for all used channels";
    "";
    "Averaging allows to increase measurement accuracy by calculating";
    "average from 4-256 ADC samples. ";
    "Averaging factor: ";
    "0 - averaging disabled";
    "1 - 4 ADC reads per channel";
    "2 - 16 ADC reads per channel";
    "3 - 64 ADC reads per channel";
    "4 - 256 ADC reads per channel";
    "";
    "Use mdaqHWInfo to get ADC parameters"
    "";
    "output - ADC value scaled to selected range";
    "";
    "Set block parameters:"];
    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok, channels, aiRange, aiMode, averaging,exprs]=..
                        scicos_getvalue(adc_desc,..
                            ['Channels:';
                            'Range:';
                            'Differential:';
                            'Averaging:'],..
                            list('row',-1,'mat',[-1,-1],'row',-1,'vec',1),exprs)
            catch
                [ok, channels, aiRange, aiMode, averaging, exprs]=..
                scicos_getvalue(adc_desc,..
                ['Channels:';
                'Range:';
                'Differential:';
                'Averaging:'],..
                list('row',-1,'mat',[-1,-1],'row',-1,'vec',1),exprs)
            end

            if ~ok then
                break
            end

            ch_count = size(channels, 'c');
            if %microdaq.private.mdaq_hwid <> [] then
                adc_id = %microdaq.private.mdaq_hwid(2);
                if ok & (find(adc_id == get_adc_list()) == []) then
                    ok = %f;
                    message("Configuration not detected - run mdaqHWInfo and try again!");
                end

                if ok & size(channels, 'r') > 1 then
                    message("Single row channel vector expected!")
                    ok = %f;
                end

                if ok & size(aiRange, 'c') <> 2 then
                    message("Vector range [low,high;low,high;...] expected!")
                    ok = %f;
                end

                if ok & size(aiMode, 'r') > 1 then
                    message("Single row measurement mode vector expected!")
                    ok = %f;
                end

                aiRangeSize = size(aiRange, 'r');
                if ok &  (aiRangeSize <> 1 & aiRangeSize <> ch_count) then
                    message("Range vector should match selected channels!")
                    ok = %f;
                end

                aiModeSize = size(aiMode, 'c');
                if ok & (aiModeSize <> 1 & aiModeSize <> ch_count) then
                    message("Mode vector should match selected channels!")
                    ok = %f;
                end

                if ok & (averaging < 0) | (averaging > 4) then
                    ok = %f;
                    message("Wrong averaging facator selected!");
                end

                if aiRangeSize == 1 & ok then
                    range_tmp = aiRange;
                    aiRange = ones(ch_count,2);
                    aiRange(:,1) = range_tmp(1);
                    aiRange(:,2) = range_tmp(2);
                end

                if aiModeSize == 1 & ok then
                    aiMode = ones(1, ch_count)*aiMode;
                end

                if ok & ~exists("%scicos_prob") then
                    result = adc_check_params(channels, aiRange, aiMode);
                    if result < 0 then
                        message(mdaq_error2(result));
                        ok = %f;
                    end
                end
            else
                ok = %f;
                message('Unable to detect MicroDAQ confituration - run mdaqHWInfo and try again!');
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, [], ch_count, 1, []);
                graphics.exprs = exprs;
                model.ipar=[ch_count; averaging; channels'; aiMode'];
                model.rpar= matrix(aiRange', 1, ch_count*2)';
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break;
            end
        end
    case 'define' then
        aiRange = [-10,10];
        aiMode = 0;
        adc_range_sim = 1;
        averaging= 0;
        ch_count = 1;
        channels = 1;
        model=scicos_model()
        model.sim=list('mdaq_adc_sim',5)
        model.out=[1]
        model.outtyp=[1]
        model.evtin=1
        model.rpar=aiRange;
        model.ipar= [ch_count; averaging; channels'; aiMode'];
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(channels); sci2exp(aiRange); sci2exp(aiMode); sci2exp(averaging)];
        gr_i=['xstringb(orig(1),orig(2),[''CH: '' ; string(channels)],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%1$s;fontColor=#5f5f5f"]
    end
endfunction

function [x,y,typ] = mdaq_adc(job,arg1,arg2)
    global %microdaq;

    adc_desc = ["This block reads MicroDAQ analog inputs (AI). Block detects";
    "MicroDAQ analog inputs type and allows channel, range";
    "and measurement type selection.";
    "In order to select analog input channels scalar or vector";
    "containing channel number have to be provided.";
    "Input range can be selected by providing scalar or vector";
    "with range identifiers. If single range provided it will";
    "be applied for all selected channels."
    "Single-ended or differential measurement type can be selected.";
    "Scalar or vector with 1 and 0 values can be provided to enable";
    "and disable differential mode.";
    "If scalar is provided it will be applied for all used channels";
    "";
    "Averaging allows to increase measurement accuracy by calculating";
    "average from 4-256 ADC samples. ";
    "Averaging factor: ";
    "0 - averaging disabled";
    "1 - 4 ADC reads per channel";
    "2 - 16 ADC reads per channel";
    "3 - 64 ADC reads per channel";
    "4 - 256 ADC reads per channel";
    "";
    "Use mdaqHWInfo to get ADC parameters"
    "";
    "output - ADC value scaled to selected range";
    "";
    "Set block parameters:"];
    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok, channels, aiRange, aiMode, averaging,exprs]=..
                        scicos_getvalue(adc_desc,..
                            ['Channels:';
                            'Range:';
                            'Differential:';
                            'Averaging:'],..
                            list('row',-1,'mat',[-1,-1],'row',-1,'vec',1),exprs)
            catch
                [ok, channels, aiRange, aiMode, averaging, exprs]=..
                scicos_getvalue(adc_desc,..
                ['Channels:';
                'Range:';
                'Differential:';
                'Averaging:'],..
                list('row',-1,'mat',[-1,-1],'row',-1,'vec',1),exprs)
            end

            if ~ok then
                break
            end

            ch_count = size(channels, 'c');
            if %microdaq.private.mdaq_hwid <> [] then
                adc_id = %microdaq.private.mdaq_hwid(2);
                if ok & (find(adc_id == get_adc_list()) == []) then
                    ok = %f;
                    message("Configuration not detected - run mdaqHWInfo and try again!");
                end

                if ok & size(channels, 'r') > 1 then
                    message("Single row channel vector expected!")
                    ok = %f;
                end

                if ok & size(aiRange, 'c') <> 2 then
                    message("Vector range [low,high;low,high;...] expected!")
                    ok = %f;
                end

                if ok & size(aiMode, 'r') > 1 then
                    message("Single row measurement mode vector expected!")
                    ok = %f;
                end

                aiRangeSize = size(aiRange, 'r');
                if ok &  (aiRangeSize <> 1 & aiRangeSize <> ch_count) then
                    message("Range vector should match selected channels!")
                    ok = %f;
                end

                aiModeSize = size(aiMode, 'c');
                if ok & (aiModeSize <> 1 & aiModeSize <> ch_count) then
                    message("Mode vector should match selected channels!")
                    ok = %f;
                end

                if ok & (averaging < 0) | (averaging > 4) then
                    ok = %f;
                    message("Wrong averaging facator selected!");
                end

                if aiRangeSize == 1 & ok then
                    range_tmp = aiRange;
                    aiRange = ones(ch_count,2);
                    aiRange(:,1) = range_tmp(1);
                    aiRange(:,2) = range_tmp(2);
                end

                if aiModeSize == 1 & ok then
                    aiMode = ones(1, ch_count)*aiMode;
                end

                if ok & ~exists("%scicos_prob") then
                    result = adc_check_params(channels, aiRange, aiMode);
                    if result < 0 then
                        message(mdaq_error2(result));
                        ok = %f;
                    end
                end
            else
                ok = %f;
                message('Unable to detect MicroDAQ confituration - run mdaqHWInfo and try again!');
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, [], ch_count, 1, []);
                graphics.exprs = exprs;
                model.ipar=[ch_count; averaging; channels'; aiMode'];
                model.rpar= matrix(aiRange', 1, ch_count*2)';
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break;
            end
        end
    case 'define' then
        aiRange = [-10,10];
        aiMode = 0;
        adc_range_sim = 1;
        averaging= 0;
        ch_count = 1;
        channels = 1;
        model=scicos_model()
        model.sim=list('mdaq_adc_sim',5)
        model.out=[1]
        model.outtyp=[1]
        model.evtin=1
        model.rpar=aiRange;
        model.ipar=[ch_count; averaging; channels; aiRange'; aiMode];
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(channels); sci2exp(aiRange); sci2exp(aiMode); sci2exp(averaging)];
        gr_i=['xstringb(orig(1),orig(2),[''CH: '' ; string(channels)],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%1$s;fontColor=#5f5f5f"]
    end
endfunction


Delete test file

Delete test file

        mprintf("\nFor more help on MicroDAQ toolbox, DSP managment functions, C code integration\ntools and other MicroDAQ toolbox features see help (help microdaq).\n\n");
        mprintf("WARNING: MicroDAQ toolbox ver 1.2.x requires firmware ver 2.0.0 or higher.\n\t Make sure that latest firmware has been installed. Link to latest\n\t firmware version https://github.com/microdaq/Firmware\n\n\t TI Code Composer Studio 5.x is no longer supported. Please install\n\t proper C6000 compiler, XDC tools and SYS/BIOS according to \n\t microdaq_setup installer (help button).\n")
        sci_ver(1) = 6
        if sci_ver(1) == 5 then
            mprintf("\nRun microdaq_setup to configure toolbox:\n\tmicrodaq_setup() - GUI mode\n\tmicrodaq_setup(compilerPath, xdctoolsPath, sysbiosPath, ipAddress) - non-GUI mode");
        end

            mprintf("\nWARNING: MicroDAQ toolbox on Scilab 6.0 has limited functionality. \n\tCode generation from Xcos diagram, DSP management functions\n\tand legacy C code integration is not supported.\n\tUse Scilab 5.5.2 to have full-featured MicroDAQ toolbox for Scilab\n");
            mprintf("\nRun microdaq_setup to configure toolbox:\n\tmicrodaq_setup(ipAddress)");


sb120: #i111287# disabled failing tests for now

#111102# -o xmloff.Chart.XMLContentExporter
#111102# -o xmloff.Chart.XMLContentImporter
#111102# -o xmloff.Chart.XMLExporter
#111102# -o xmloff.Chart.XMLImporter
#111102# -o xmloff.Chart.XMLStylesExporter
#111102# -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
#i111287 -o xmloff.Draw.XMLSettingsExporter
#i111287 -o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
#i111287 -o xmloff.Impress.XMLSettingsExporter
#i111287 -o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter

#111102# -o xmloff.Chart.XMLContentExporter
#111102# -o xmloff.Chart.XMLContentImporter
#111102# -o xmloff.Chart.XMLExporter
#111102# -o xmloff.Chart.XMLImporter
#111102# -o xmloff.Chart.XMLStylesExporter
#111102# -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
-o xmloff.Impress.XMLSettingsExporter
-o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter


Change path functions to be usable for everyone

clear(); // Löschen aller Variablen
clearglobal(); // Löschen aller globalen Variablen

// Set up working variables
global PI
PI = 3.1415
global DELTA_T
DELTA_T = 0.02
global g
g = 9.81

// Set up proband varibales
proband_mass = 85

// Current working directory, load all functions from .sci filess
cwd = get_absolute_file_path('inverse_kinetic.sce')
getd(cwd);

// GET DATA PATH
data_path = uigetfile(["*.mdf", "Output from ImageJ"], cwd + "/../data/Laufen/felix/","Select CSV data",%t);

for i = 1 : size(data_path, 2)

    // READ DATA

    [toes, ankle, knee, hip, shoulder, elbow, hand, neck] = readFromMDF(data_path(i))

    [foot, leg, thigh, leg_total, upperarm, forearm, arm_total, trunk] = createLimbs(toes, ankle, knee, hip, shoulder, elbow, hand, neck)

    // ANALYZE DATA

    // Calculate speeds, acceleration, abs speed, abs acc, smoothed speed (double moving mean)n angle and
    foot = anal(foot)
    leg = anal(leg)
    thigh = anal(thigh)
    leg_total = anal(leg_total)
    upperarm = anal(upperarm)
    forearm = anal(forearm)
    arm_total = anal(arm_total)

    // Create Container for iteration
    //limbs = [foot, leg, thigh, leg_total, upperarm, forearm, arm_total]

    // Calculate ground reaction force

    Waage.x = 2.0
    Waage.y = 0.23

    a = 0.03
    b = 0.0575
    CoB = b
    CoBx = 1.5

    // GET CALIBRATION AND FORCE MEASUREMENTS

    caldir = uigetdir(cwd + "../data/", "Select Calibration Directory")
    forcefile = uigetfile("*.txt*", cwd + "../data/", "Select force measurement",%t)

    //forcefile = cwd + "../data/Waage/felix/schnell.txt"
    //caldir = cwd + "../data/Waage/Kalibrierung/"

    driftfile = caldir + '/Waagendrift_clean.txt';
    offsetDataRaw = readScaleFile(driftfile);
    xCalFile = caldir + '/XKali_clean.txt';
    xCalRaw = readScaleFile(xCalFile)
    yCalFile = caldir + '/YKali_clean.txt';
    yCalRaw = readScaleFile(yCalFile);
    zCalFile = caldir + '/ZKali_clean.txt';
    zCalRaw = readScaleFile(zCalFile);

    grfRaw = readScaleFile(forcefile)

    offsetData = combineChannels(offsetDataRaw, b, CoB)
    xCal = combineChannels(xCalRaw, b, CoB)
    yCal = combineChannels(yCalRaw, b, CoB)
    zCal = combineChannels(zCalRaw, b, CoB)
    grfSum = combineChannels(grfRaw, b, CoB)

    // Determine initial Contact from force Data
    scf(1)
    plot2d(grfSum(:,5))
    forceStart = locate(1)
    startBalance = int(forceStart(1))

    // Determine initial Contact from Kinematic Data
    scf(2)
    plot2d(ankle.y)
    startContact = locate(1)
    initialContact = int(startContact(1))

    // Create Ground reaction force object
    grf.Fx = grfSum(startBalance:2:size(grfSum, 1),3)
    grf.Fy = grfSum(startBalance:2:size(grfSum, 1),4)
    grf.x = grfSum(startBalance:2:size(grfSum, 1), 5)
    grf.y = 1.5

    // INVERSE KINETICS

    liftOff = size(foot.x, 1)
    contactLength = liftOff - initialContact

    // Slice data that is needed for inverse kinetics to frames with ground contact

    foot.acc.x = foot.acc.x(initialContact: liftOff)
    foot.acc.y = foot.acc.y(initialContact: liftOff)
    foot.angacc = foot.angacc(initialContact : liftOff)
    foot.x = foot.x(initialContact : liftOff)
    foot.y = foot.y(initialContact : liftOff)
    ankle.x = ankle.x(initialContact : liftOff)
    ankle.y = ankle.y(initialContact : liftOff)

    leg.acc.x = leg.acc.x(initialContact : liftOff)
    leg.acc.y = leg.acc.y(initialContact : liftOff)
    leg.angacc = leg.angacc(initialContact : liftOff)
    leg.x = leg.x(initialContact : liftOff)
    leg.y = leg.y(initialContact : liftOff)
    knee.x = knee.x(initialContact : liftOff)
    knee.y = knee.y(initialContact : liftOff)

    thigh.acc.x = thigh.acc.x(initialContact : liftOff)
    thigh.acc.y = thigh.acc.y(initialContact : liftOff)
    thigh.angacc = thigh.angacc(initialContact : liftOff)
    thigh.x = thigh.x(initialContact : liftOff)
    thigh.y = thigh.y(initialContact : liftOff)
    hip.x = hip.x(initialContact : liftOff)
    hip.y = hip.y(initialContact : liftOff)

    // Iterate over ground contact duration
    for i = 1 : contactLength
        // Calculate Joint forces and moments
        ankle.Fx(i) = foot.mass * foot.acc.x(i) - grf.Fx(i)
        ankle.Fy(i) = foot.mass * (foot.acc.y(i) - g) - grf.Fy(i)
        ankle.M(i) = foot.MoI * foot.angacc(i) - ankle.Fy(i) * (ankle.x(i) - foot.x(i)) ...
                  - ankle.Fx(i) * (foot.y(i) - ankle.y(i)) - grf.Fx(i) * ( foot.y(i) - grf.y ) - grf.Fy(i) * (grf.x(i) - foot.x(i))

        knee.Fx(i) = leg.mass * leg.acc.x(i) + ankle.Fx(i)
        knee.Fy(i) = leg.mass * (leg.acc.y(i) - g) + ankle.Fy(i)
        knee.M(i) = ankle.M(i) + leg.MoI * leg.angacc(i) - knee.Fy(i) * (knee.x(i) - leg.x(i))...
                 - knee.Fx(i) * (leg.y(i) - knee.y(i)) + ankle.Fx(i) * (leg.y(i) - ankle.y(i)) + ankle.Fy(i) * (ankle.x(i) - leg.y(i))

        hip.Fx(i) = thigh.mass * thigh.acc.x(i) + knee.Fx(i)
        hip.Fy(i) = thigh.mass * (thigh.acc.y(i) - g) + knee.Fy(i)
        hip.M(i) = knee.M(i) + thigh.MoI * thigh.angacc(i) - hip.Fy(i) * (hip.x(i) - thigh.x(i))...
                 - hip.Fx(i) * (thigh.y(i) - hip.y(i)) + knee.Fx(i) * (thigh.y(i) - knee.y(i)) + knee.Fy(i) * (knee.x(i) - thigh.y(i))
     end

//    scf(99)
//    plot2d([knee.Fx, knee.Fy])
end

clear(); // Löschen aller Variablen
clearglobal(); // Löschen aller globalen Variablen

// Set up working variables
global PI
PI = 3.1415
global DELTA_T
DELTA_T = 0.02
global g
g = 9.81

// Set up proband varibales
proband_mass = 85

// Current working directory, load all functions from .sci filess
cwd = get_absolute_file_path('inverse_kinetic.sce')
getd(cwd);

// GET DATA PATH
data_path = uigetfile(["*.mdf", "Output from ImageJ"], cwd + "/../data/Laufen/felix/","Select CSV data",%t);

for i = 1 : size(data_path, 2)

    // READ DATA

    [toes, ankle, knee, hip, shoulder, elbow, hand, neck] = readFromMDF(data_path(i))

    [foot, leg, thigh, leg_total, upperarm, forearm, arm_total, trunk] = createLimbs(toes, ankle, knee, hip, shoulder, elbow, hand, neck)

    // ANALYZE DATA

    // Calculate speeds, acceleration, abs speed, abs acc, smoothed speed (double moving mean)n angle and
    foot = anal(foot)
    leg = anal(leg)
    thigh = anal(thigh)
    leg_total = anal(leg_total)
    upperarm = anal(upperarm)
    forearm = anal(forearm)
    arm_total = anal(arm_total)

    // Create Container for iteration
    //limbs = [foot, leg, thigh, leg_total, upperarm, forearm, arm_total]

    // Calculate ground reaction force

    Waage.x = 2.0
    Waage.y = 0.23

    a = 0.03
    b = 0.0575
    CoB = b
    CoBx = 1.5

    // GET CALIBRATION AND FORCE MEASUREMENTS

    //caldir = uigetdir(cwd + "../data/")
    //forcefile = uigetfile("*.txt*", cwd + "../data/", "Select force measurement",%t)

    forcefile = cwd + "../data/Waage/felix/schnell.txt"
    caldir = cwd + "../data/Waage/Kalibrierung/"

    driftfile = caldir + '/Waagendrift_clean.txt';
    offsetDataRaw = readScaleFile(driftfile);
    xCalFile = caldir + '/XKali_clean.txt';
    xCalRaw = readScaleFile(xCalFile)
    yCalFile = caldir + '/YKali_clean.txt';
    yCalRaw = readScaleFile(yCalFile);
    zCalFile = caldir + '/ZKali_clean.txt';
    zCalRaw = readScaleFile(zCalFile);

    grfRaw = readScaleFile(forcefile)

    offsetData = combineChannels(offsetDataRaw, b, CoB)
    xCal = combineChannels(xCalRaw, b, CoB)
    yCal = combineChannels(yCalRaw, b, CoB)
    zCal = combineChannels(zCalRaw, b, CoB)
    grfSum = combineChannels(grfRaw, b, CoB)

    // Determine initial Contact from force Data
    scf(1)
    plot2d(grfSum(:,5))
    forceStart = locate(1)
    startBalance = int(forceStart(1))

    // Determine initial Contact from Kinematic Data
    scf(2)
    plot2d(ankle.y)
    startContact = locate(1)
    initialContact = int(startContact(1))

    // Create Ground reaction force object
    grf.Fx = grfSum(startBalance:2:size(grfSum, 1),3)
    grf.Fy = grfSum(startBalance:2:size(grfSum, 1),4)
    grf.x = grfSum(startBalance:2:size(grfSum, 1), 5)
    grf.y = 1.5

    // INVERSE KINETICS

    liftOff = size(foot.x, 1)
    contactLength = liftOff - initialContact

    // Slice data that is needed for inverse kinetics to frames with ground contact

    foot.acc.x = foot.acc.x(initialContact: liftOff)
    foot.acc.y = foot.acc.y(initialContact: liftOff)
    foot.angacc = foot.angacc(initialContact : liftOff)
    foot.x = foot.x(initialContact : liftOff)
    foot.y = foot.y(initialContact : liftOff)
    ankle.x = ankle.x(initialContact : liftOff)
    ankle.y = ankle.y(initialContact : liftOff)

    leg.acc.x = leg.acc.x(initialContact : liftOff)
    leg.acc.y = leg.acc.y(initialContact : liftOff)
    leg.angacc = leg.angacc(initialContact : liftOff)
    leg.x = leg.x(initialContact : liftOff)
    leg.y = leg.y(initialContact : liftOff)
    knee.x = knee.x(initialContact : liftOff)
    knee.y = knee.y(initialContact : liftOff)

    thigh.acc.x = thigh.acc.x(initialContact : liftOff)
    thigh.acc.y = thigh.acc.y(initialContact : liftOff)
    thigh.angacc = thigh.angacc(initialContact : liftOff)
    thigh.x = thigh.x(initialContact : liftOff)
    thigh.y = thigh.y(initialContact : liftOff)
    hip.x = hip.x(initialContact : liftOff)
    hip.y = hip.y(initialContact : liftOff)

    // Iterate over ground contact duration
    for i = 1 : contactLength
        // Calculate Joint forces and moments
        ankle.Fx(i) = foot.mass * foot.acc.x(i) - grf.Fx(i)
        ankle.Fy(i) = foot.mass * (foot.acc.y(i) - g) - grf.Fy(i)
        ankle.M(i) = foot.MoI * foot.angacc(i) - ankle.Fy(i) * (ankle.x(i) - foot.x(i)) ...
                  - ankle.Fx(i) * (foot.y(i) - ankle.y(i)) - grf.Fx(i) * ( foot.y(i) - grf.y ) - grf.Fy(i) * (grf.x(i) - foot.x(i))

        knee.Fx(i) = leg.mass * leg.acc.x(i) + ankle.Fx(i)
        knee.Fy(i) = leg.mass * (leg.acc.y(i) - g) + ankle.Fy(i)
        knee.M(i) = ankle.M(i) + leg.MoI * leg.angacc(i) - knee.Fy(i) * (knee.x(i) - leg.x(i))...
                 - knee.Fx(i) * (leg.y(i) - knee.y(i)) + ankle.Fx(i) * (leg.y(i) - ankle.y(i)) + ankle.Fy(i) * (ankle.x(i) - leg.y(i))

        hip.Fx(i) = thigh.mass * thigh.acc.x(i) + knee.Fx(i)
        hip.Fy(i) = thigh.mass * (thigh.acc.y(i) - g) + knee.Fy(i)
        hip.M(i) = knee.M(i) + thigh.MoI * thigh.angacc(i) - hip.Fy(i) * (hip.x(i) - thigh.x(i))...
                 - hip.Fx(i) * (thigh.y(i) - hip.y(i)) + knee.Fx(i) * (thigh.y(i) - knee.y(i)) + knee.Fy(i) * (knee.x(i) - thigh.y(i))
     end

//    scf(99)
//    plot2d([knee.Fx, knee.Fy])
end


read en write Wav toegevoegd

read en write Wav toegevoegd

[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest2(anja).wav");
//[testsign,Fs,bits]=wavread("SCI/modules/sound/demos/filterTest1(H-style).wav");

testsign = testsign(1,:);
t = [1:1:length(testsign)]*1/Fs;

[LD_coeff, amplitude, frequentie] = wfir('bp',100,[2050/16000, 0.5],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

plot(t, testsign)
plot(t, LD_output, 'r');

wavwrite(LD_output, 'SCI/modules/sound/demos/'+'yolo.wav');

t = [0: 0.0000625: 0.02];
N = size(t, '*');
sin_100Hz = 2*sin(2*%pi*700*t);
sin_1000Hz = 2*sin(2*%pi*1000*t);
sin_5000Hz = 2*sin(2*%pi*5000*t);
testsign = sin_100Hz + sin_1000Hz + sin_5000Hz;
[LD_coeff, amplitude, frequentie] = wfir('bp',100,[2050/16000, 0.5],'hm',[0 0]);
LD_polynoom = poly(LD_coeff, 'z', 'coeff');
LD_functie = horner(LD_polynoom, 1/%z);
LD_lineair_system = syslin('d', LD_functie);
LD_output = flts(testsign, LD_lineair_system);

Frequentie_FFT = abs(fft(testsign));
f = 16000 * (0:(N/2))/N;
n = size(f, '*');
figure;

subplot(311);
plot(f, Frequentie_FFT(1:n));
plot(frequentie*16000, amplitude*N, 'black');
subplot(312);
plot(t, LD_output, 'r');
subplot(313);
plot(t, testsign)
plot(t, LD_output, 'r');
plot(t, sin_5000Hz, 'g');


sb120: #i109939# disabled failing tests for now

-o forms.OButtonControl
-o forms.OButtonModel
-o forms.OCheckBoxControl
-o forms.OCheckBoxModel
-o forms.OComboBoxControl
-o forms.OComboBoxModel
-o forms.OCurrencyControl
-o forms.OCurrencyModel
#-o forms.ODatabaseForm
-o forms.ODateControl
-o forms.ODateModel
-o forms.OEditControl
-o forms.OEditModel
#i109939 -o forms.OFileControlModel
-o forms.OFixedTextModel
-o forms.OFormattedControl
#i109939 -o forms.OFormattedFieldWrapper
# LSST EIN DOKUMENT OFFEN -o forms.OFormsCollection
-o forms.OGridControlModel
-o forms.OGroupBoxControl
-o forms.OGroupBoxModel
-o forms.OHiddenModel
-o forms.OImageButtonControl
-o forms.OImageButtonModel
-o forms.OImageControlControl
-o forms.OImageControlModel
-o forms.OListBoxControl
-o forms.OListBoxModel
-o forms.ONavigationBarControl
-o forms.ONavigationBarModel
-o forms.ONumericControl
-o forms.ONumericModel
-o forms.OPatternControl
-o forms.OPatternModel
-o forms.ORadioButtonControl
-o forms.ORadioButtonModel
-o forms.OScrollBarModel
-o forms.OSpinButtonModel
-o forms.OTimeControl
-o forms.OTimeModel

-o forms.OButtonControl
-o forms.OButtonModel
-o forms.OCheckBoxControl
-o forms.OCheckBoxModel
-o forms.OComboBoxControl
-o forms.OComboBoxModel
-o forms.OCurrencyControl
-o forms.OCurrencyModel
#-o forms.ODatabaseForm
-o forms.ODateControl
-o forms.ODateModel
-o forms.OEditControl
-o forms.OEditModel
#i109939 -o forms.OFileControlModel
-o forms.OFixedTextModel
-o forms.OFormattedControl
-o forms.OFormattedFieldWrapper
# LSST EIN DOKUMENT OFFEN -o forms.OFormsCollection
-o forms.OGridControlModel
-o forms.OGroupBoxControl
-o forms.OGroupBoxModel
-o forms.OHiddenModel
-o forms.OImageButtonControl
-o forms.OImageButtonModel
-o forms.OImageControlControl
-o forms.OImageControlModel
-o forms.OListBoxControl
-o forms.OListBoxModel
-o forms.ONavigationBarControl
-o forms.ONavigationBarModel
-o forms.ONumericControl
-o forms.ONumericModel
-o forms.OPatternControl
-o forms.OPatternModel
-o forms.ORadioButtonControl
-o forms.ORadioButtonModel
-o forms.OScrollBarModel
-o forms.OSpinButtonModel
-o forms.OTimeControl
-o forms.OTimeModel