Fix typo - scritp filename

Fix typo - scritp filename

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.
// This file is released under the 3-clause BSD license. See COPYING-BSD.

//check compatibility
sci_ver = getversion('scilab');
[sci_ver_str opts] = getversion();
if (sci_ver(1) <> 5) | (sci_ver(2) <> 5) | (sci_ver(3) < 2)  then
    if sci_ver(1) <> 6 then
        error(gettext('Scilab 5.5.2 or 6.x.x is required.'));
    end
end

//LINUX: ONLY X64 ARCHITECTURE SUPPORT
if getos() == "Linux" & opts(2) == 'x86' then
    mprintf("\nERROR:  Linux x86 platform is no longer supported.\n\tList of supported platforms can be found here: http://atoms.scilab.org/toolboxes/microdaq");
    return;
end

// create global microdaq settings struct
global %microdaq;
%microdaq = struct("model", ["Unknown"],..
                            "ip_address", [],..
                            "dsp_loaded", %F,..
                            "dsp_ext_mode", %T,..
                            "dsp_debug_mode", %F,..
                            "private", struct(..
                            "mlink_link_id", -1000,..
                            "userhostlib_link_id", -1000,..
                            "connection_id", -1,..
                            "has_mdaq_block", %F,..
                            "has_mdaq_param_sim", %F,..
                            "mem_write_idx", 0,..
                            "mem_read_idx", 0,..
                            "to_file_idx", 0,..
                            "dac_idx", 0,..
                            "adc_idx", 0,..
                            "webscope_idx", 0,..
                            "udpsend_idx", 0,..
                            "udprecv_idx", 0,..
                            "tcpsend_idx", 0,..
                            "tcprecv_idx", 0,..
                            "mdaq_signal_id", 0,..
                            "mdaq_param_id", 0,..
                            "ao_scan_ch_count", -1,..
                            "mdaq_hwid",..
                            "adc_info",..
                            "dac_info", [])..
                            );

// check minimal version (xcosPal required)
// =============================================================================
if ~isdef('xcosPal') then
    // and xcos features required
    error(gettext('Scilab 5.5.2 or more is required.'));
end

// =============================================================================
// force to load some libraries (dependancies)
loadScicos();
// =============================================================================
etc_tlbx  = get_absolute_file_path("microdaq_start_sci6.sce");
etc_tlbx  = getshortpathname(etc_tlbx);
root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );

fd=mopen(root_tlbx+filesep()+"VERSION");
version=mgetl(fd,-1);
mclose(fd);

mprintf("Start MicroDAQ toolbox ver: %s\n", mgetl(root_tlbx + filesep() + "VERSION", 1));

if isdef("microdaqlib") then
    warning("MicroDAQ toolbox is already loaded!");
    return;
end

// Load functions library
// =============================================================================
mprintf("\tLoad macros\n");
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();

if isdir(pathmacros) == %F then
    macroBinPath = pathconvert(root_tlbx+'/bin/'+string(sci_ver(1)));
    copyfile(macroBinPath, root_tlbx);
end

microdaqlib = lib(pathmacros);
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep() + "microdaq_blocks" + filesep();
microdaqBlocks = lib(pathmacros);
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep() + "microdaq_macros" + filesep();
microdaqMacros = lib(pathmacros);
userblock_path = root_tlbx + pathconvert("/macros/user_blocks/");

if isfile(mdaqToolboxPath() + "etc"+filesep()+"mlink"+filesep()+"hwid") then
    load(mdaqToolboxPath() + "etc"+filesep()+"mlink"+filesep()+"hwid");
    %microdaq.private.mdaq_hwid = mdaq_hwid;
    %microdaq.private.adc_info = adc_info;
    %microdaq.private.dac_info = dac_info;

    %microdaq.model = 'MicroDAQ E' + string(mdaq_hwid(1))..
    + '-ADC0' + string(mdaq_hwid(2))..
    + '-DAC0' + string(mdaq_hwid(3))..
    + '-' + string(mdaq_hwid(4)) + string(mdaq_hwid(5));
    clear mdaq_hwid;
end

// Load demos
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
    mprintf("\tLoad demos\n");
    pathdemos = pathconvert(root_tlbx+filesep()+"demos"+filesep()+"microdaq.dem.gateway.sce", %F, %T);
    add_demo("MicroDAQ", pathdemos);
end

// Load and add help chapter
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
    mprintf("\tLoad help\n");
    path_addchapter = pathconvert(root_tlbx+'/jar/', %F);
    if ( isdir(path_addchapter) <> [] ) then
        add_help_chapter("MicroDAQ", path_addchapter, %F);
    else
        warning("Cannot load help file.")
    end
end

// Load shared libraries
mprintf("\tLoad MLink library\n");
exec(pathconvert(root_tlbx + "/etc/mlink/MLink.sce", %f),-1);

if (sci_ver_str == 'scilab-5.5.2') | (sci_ver_str == 'scilab-5.5.2.1') then
    if isdef("xcosAddToolsMenu") == %F then
        loadXcosLibs();
        sleep(1000)
    end

    // Load libmdaqblocks
    exec(pathconvert(root_tlbx + "/etc/mdaqlib/loader.sce", %f),-1);

    // Add MicroDAQ toolbox options to XCos menu
    xcosAddToolsMenu("MicroDAQ web panel", "mdaq_webpanel()");
    xcosAddToolsMenu("MicroDAQ user disk", "mdaq_userdisk()");
    xcosAddToolsMenu("MicroDAQ execution profile", "mdaq_exec_profile_show()");
    xcosAddToolsMenu("MicroDAQ upload model", "mdaq_dsp_upload()");
    xcosAddToolsMenu("MicroDAQ build model", "mdaq_code_gen(%F)");
    xcosAddToolsMenu("MicroDAQ load model", "load_last_dsp_image()");
    xcosAddToolsMenu("MicroDAQ build and load model", "mdaq_code_gen(%T)");

    // Add blocks to the Xcos palette
    // =============================================================================
    mprintf("\tLoad MicroDAQ blocks\n");

    // if TMPDIR contains gif or svg files remove them
    img_files = ls(TMPDIR);
    img_files_index = grep(img_files, ".gif");
    if img_files_index <> [] then
        for i = 1:size(img_files_index, '*')
            deletefile(TMPDIR + filesep() + img_files(img_files_index(i)));
        end
    end

    img_files_index = grep(img_files, ".svg");
    if img_files_index <> [] then
        for i = 1:size(img_files_index, '*')
            deletefile(TMPDIR + filesep() + img_files(img_files_index(i)));
        end
    end
end
    // ---- Load MicroDAQ User blocks ----
    // This feature is not available on Scilab 6, yet
    if sci_ver(1) <> 6 then
        if isfile(userblock_path+'lib') == %T then
            microdaqUserBlocks = lib(userblock_path);
        else
            microdaqUserBlocks = [];
        end
        // Load MicroDAQ base blocks
        load_mdaq_palette();

        if isfile(userblock_path+'lib') == %T then
            mprintf("\tLoad MicroDAQ User blocks\n");

            blocks = [];
            tmp_path = pwd();
            cd(userblock_path);
            macros = ls("mdaq_*.bin");
            cd(tmp_path);
            for b=1:size(macros, "r")
                macros(b) = part(macros(b), 1:length(macros(b)) - 4);
                if part(macros(b), length(macros(b)) - 3:length(macros(b))) <> "_sim"
                    if isfile(userblock_path + macros(b) + '.sci')  == %T then
                        blocks = [blocks, macros(b)];
                    end
                end
            end

            pal = xcosPal("MicroDAQ User");

            for i=1:size(blocks, "*")
                h5  = ls(root_tlbx + "/images/h5/"  + blocks(i) + "." + ["sod" "h5"]);
                gif = ls(root_tlbx + "/images/gif/" + blocks(i) + "." + ["png" "jpg" "gif"]);
                svg = ls(root_tlbx + "/images/svg/" + blocks(i) + "." + ["png" "jpg" "gif" "svg"]);
                pal = xcosPalAddBlock(pal, h5(1), gif(1), svg(1));
            end

            if ~xcosPalAdd(pal,"MicroDAQ User") then
                error(msprintf(gettext("%s: Unable to export %s.\n"), "microdaq.start", "pal"));
            end
        end
    end

    %microdaq.ip_address = mdaq_get_ip();
if sci_ver(1) == 5 then
        if check_mdaq_compiler() == %F then
            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 following links:\n\n")
            mprintf("\t - C6000 compiler, ver. 7.4.21:              http://software-dl.ti.com/codegen/non-esd/downloads/download.htm#C6000\n");
            mprintf("\t - XDCTools, ver. 3.50.00.10 (with a JRE):   http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/\n");
            mprintf("\t - SYS/BIOS, ver. 6.50.01.12:                http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sysbios/\n\n");

            mprintf("WARNING: Replace all MicroDAQ blocks in your existing models with blocks from release 1.2v.\n");
            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
        end

    userhostlib_loader = root_tlbx + pathconvert("/etc/userlib/hostlib/loader.sce", %f);

    if isfile(userhostlib_loader) then
        mprintf("\tLoad user host library\n");
        exec(userhostlib_loader);
    end
else
    [mdaq_ip_addr, res] = mdaq_get_ip();
    if mdaq_ip_addr == [] then
       mprintf("\nWARNING: DSP support on MicroDAQ E2000/E1100 is not available\n\t on Scilab 6.0.0. Use Scilab 5.5.2 for C code generation\n\t for DSP.\n");
       mprintf("\nRun microdaq_setup to configure toolbox:\n\tmicrodaq_setup(ipAddress)");
    end
end

// Copyright (c) 2015, Embedded Solutions
// All rights reserved.
// This file is released under the 3-clause BSD license. See COPYING-BSD.

//check compatibility
sci_ver = getversion('scilab');
[sci_ver_str opts] = getversion();
if (sci_ver(1) <> 5) | (sci_ver(2) <> 5) | (sci_ver(3) < 2)  then
    if sci_ver(1) <> 6 then
        error(gettext('Scilab 5.5.2 or 6.x.x is required.'));
    end
end

//LINUX: ONLY X64 ARCHITECTURE SUPPORT
if getos() == "Linux" & opts(2) == 'x86' then
    mprintf("\nERROR:  Linux x86 platform is no longer supported.\n\tList of supported platforms can be found here: http://atoms.scilab.org/toolboxes/microdaq");
    return;
end

// create global microdaq settings struct
global %microdaq;
%microdaq = struct("model", ["Unknown"],..
                            "ip_address", [],..
                            "dsp_loaded", %F,..
                            "dsp_ext_mode", %T,..
                            "dsp_debug_mode", %F,..
                            "private", struct(..
                            "mlink_link_id", -1000,..
                            "userhostlib_link_id", -1000,..
                            "connection_id", -1,..
                            "has_mdaq_block", %F,..
                            "has_mdaq_param_sim", %F,..
                            "mem_write_idx", 0,..
                            "mem_read_idx", 0,..
                            "to_file_idx", 0,..
                            "dac_idx", 0,..
                            "adc_idx", 0,..
                            "webscope_idx", 0,..
                            "udpsend_idx", 0,..
                            "udprecv_idx", 0,..
                            "tcpsend_idx", 0,..
                            "tcprecv_idx", 0,..
                            "mdaq_signal_id", 0,..
                            "mdaq_param_id", 0,..
                            "ao_scan_ch_count", -1,..
                            "mdaq_hwid",..
                            "adc_info",..
                            "dac_info", [])..
                            );

// check minimal version (xcosPal required)
// =============================================================================
if ~isdef('xcosPal') then
    // and xcos features required
    error(gettext('Scilab 5.5.2 or more is required.'));
end

// =============================================================================
// force to load some libraries (dependancies)
loadScicos();
// =============================================================================
etc_tlbx  = get_absolute_file_path("microdaq_start_sci5.sce");
etc_tlbx  = getshortpathname(etc_tlbx);
root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );

fd=mopen(root_tlbx+filesep()+"VERSION");
version=mgetl(fd,-1);
mclose(fd);

mprintf("Start MicroDAQ toolbox ver: %s\n", mgetl(root_tlbx + filesep() + "VERSION", 1));

if isdef("microdaqlib") then
    warning("MicroDAQ toolbox is already loaded!");
    return;
end

// Load functions library
// =============================================================================
mprintf("\tLoad macros\n");
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();

if isdir(pathmacros) == %F then
    macroBinPath = pathconvert(root_tlbx+'/bin/'+string(sci_ver(1)));
    copyfile(macroBinPath, root_tlbx);
end

microdaqlib = lib(pathmacros);
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep() + "microdaq_blocks" + filesep();
microdaqBlocks = lib(pathmacros);
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep() + "microdaq_macros" + filesep();
microdaqMacros = lib(pathmacros);
userblock_path = root_tlbx + pathconvert("/macros/user_blocks/");

if isfile(mdaqToolboxPath() + "etc"+filesep()+"mlink"+filesep()+"hwid") then
    load(mdaqToolboxPath() + "etc"+filesep()+"mlink"+filesep()+"hwid");
    %microdaq.private.mdaq_hwid = mdaq_hwid;
    %microdaq.private.adc_info = adc_info;
    %microdaq.private.dac_info = dac_info;

    %microdaq.model = 'MicroDAQ E' + string(mdaq_hwid(1))..
    + '-ADC0' + string(mdaq_hwid(2))..
    + '-DAC0' + string(mdaq_hwid(3))..
    + '-' + string(mdaq_hwid(4)) + string(mdaq_hwid(5));
    clear mdaq_hwid;
end

// Load demos
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
    mprintf("\tLoad demos\n");
    pathdemos = pathconvert(root_tlbx+filesep()+"demos"+filesep()+"microdaq.dem.gateway.sce", %F, %T);
    add_demo("MicroDAQ", pathdemos);
end

// Load and add help chapter
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
    mprintf("\tLoad help\n");
    path_addchapter = pathconvert(root_tlbx+'/jar/', %F);
    if ( isdir(path_addchapter) <> [] ) then
        add_help_chapter("MicroDAQ", path_addchapter, %F);
    else
        warning("Cannot load help file.")
    end
end

// Load shared libraries
mprintf("\tLoad MLink library\n");
exec(pathconvert(root_tlbx + "/etc/mlink/MLink.sce", %f),-1);

if (sci_ver_str == 'scilab-5.5.2') | (sci_ver_str == 'scilab-5.5.2.1') then
    if isdef("xcosAddToolsMenu") == %F then
        loadXcosLibs();
        sleep(1000)
    end

    // Load libmdaqblocks
    exec(pathconvert(root_tlbx + "/etc/mdaqlib/loader.sce", %f),-1);

    // Add MicroDAQ toolbox options to XCos menu
    xcosAddToolsMenu("MicroDAQ web panel", "mdaq_webpanel()");
    xcosAddToolsMenu("MicroDAQ user disk", "mdaq_userdisk()");
    xcosAddToolsMenu("MicroDAQ execution profile", "mdaq_exec_profile_show()");
    xcosAddToolsMenu("MicroDAQ upload model", "mdaq_dsp_upload()");
    xcosAddToolsMenu("MicroDAQ build model", "mdaq_code_gen(%F)");
    xcosAddToolsMenu("MicroDAQ load model", "load_last_dsp_image()");
    xcosAddToolsMenu("MicroDAQ build and load model", "mdaq_code_gen(%T)");

    // Add blocks to the Xcos palette
    // =============================================================================
    mprintf("\tLoad MicroDAQ blocks\n");

    // if TMPDIR contains gif or svg files remove them
    img_files = ls(TMPDIR);
    img_files_index = grep(img_files, ".gif");
    if img_files_index <> [] then
        for i = 1:size(img_files_index, '*')
            deletefile(TMPDIR + filesep() + img_files(img_files_index(i)));
        end
    end

    img_files_index = grep(img_files, ".svg");
    if img_files_index <> [] then
        for i = 1:size(img_files_index, '*')
            deletefile(TMPDIR + filesep() + img_files(img_files_index(i)));
        end
    end
end
    // ---- Load MicroDAQ User blocks ----
    // This feature is not available on Scilab 6, yet
    if sci_ver(1) <> 6 then
        if isfile(userblock_path+'lib') == %T then
            microdaqUserBlocks = lib(userblock_path);
        else
            microdaqUserBlocks = [];
        end
        // Load MicroDAQ base blocks
        load_mdaq_palette();

        if isfile(userblock_path+'lib') == %T then
            mprintf("\tLoad MicroDAQ User blocks\n");

            blocks = [];
            tmp_path = pwd();
            cd(userblock_path);
            macros = ls("mdaq_*.bin");
            cd(tmp_path);
            for b=1:size(macros, "r")
                macros(b) = part(macros(b), 1:length(macros(b)) - 4);
                if part(macros(b), length(macros(b)) - 3:length(macros(b))) <> "_sim"
                    if isfile(userblock_path + macros(b) + '.sci')  == %T then
                        blocks = [blocks, macros(b)];
                    end
                end
            end

            pal = xcosPal("MicroDAQ User");

            for i=1:size(blocks, "*")
                h5  = ls(root_tlbx + "/images/h5/"  + blocks(i) + "." + ["sod" "h5"]);
                gif = ls(root_tlbx + "/images/gif/" + blocks(i) + "." + ["png" "jpg" "gif"]);
                svg = ls(root_tlbx + "/images/svg/" + blocks(i) + "." + ["png" "jpg" "gif" "svg"]);
                pal = xcosPalAddBlock(pal, h5(1), gif(1), svg(1));
            end

            if ~xcosPalAdd(pal,"MicroDAQ User") then
                error(msprintf(gettext("%s: Unable to export %s.\n"), "microdaq.start", "pal"));
            end
        end
    end

    %microdaq.ip_address = mdaq_get_ip();
if sci_ver(1) == 5 then
        if check_mdaq_compiler() == %F then
            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 following links:\n\n")
            mprintf("\t - C6000 compiler, ver. 7.4.21:              http://software-dl.ti.com/codegen/non-esd/downloads/download.htm#C6000\n");
            mprintf("\t - XDCTools, ver. 3.50.00.10 (with a JRE):   http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/rtsc/\n");
            mprintf("\t - SYS/BIOS, ver. 6.50.01.12:                http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sysbios/\n\n");

            mprintf("WARNING: Replace all MicroDAQ blocks in your existing models with blocks from release 1.2v.\n");
            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
        end

    userhostlib_loader = root_tlbx + pathconvert("/etc/userlib/hostlib/loader.sce", %f);

    if isfile(userhostlib_loader) then
        mprintf("\tLoad user host library\n");
        exec(userhostlib_loader);
    end
else
    [mdaq_ip_addr, res] = mdaq_get_ip();
    if mdaq_ip_addr == [] then
       mprintf("\nWARNING: DSP support on MicroDAQ E2000/E1100 is not available\n\t on Scilab 6.0.0. Use Scilab 5.5.2 for C code generation\n\t for DSP.\n");
       mprintf("\nRun microdaq_setup to configure toolbox:\n\tmicrodaq_setup(ipAddress)");
    end
end


To file block help update

To file block help update

function [x,y,typ] = mdaq_to_file(job,arg1,arg2)
    x=[];y=[];typ=[];

    to_file_desc = [ "To File block";
    "";
    "This block writes data to file. Files are stored on user disk in";
    "''dsp/data'' directory. Function mdaqFileData can be used to load";
    "data into Scilab workspace from file created with ''To file'' block.";
    "";
    "Block supports text and binary files. Text (CSV) files can be viewed";
    "with file browser from MicroDAQ web interface without download.";
    "";
    "Depending on the selected option data can appended to previous content";
    "of the file or data will be written to empty file (Create option)";
    "To avoid time time consuming wirte operation during every";
    "simulation step block can buffer data.";
    "";
    "Block allows sequential file creation for large data sets or events.";
    "Rising edge on Trigger input(2) will create new file. To define";
    "sequential file name use ''%d'' in the file name  e.g. data_%d.txt";
    "will create files data_0.csv, data_1.csv. If ''%d'' isn''t included"
    "in file name single file will be used.";
    "";
    "Trigger input has to be connected with a signal, if a sequential file is ";
    "not used, the constant block with value 1 shall be connected.";
    "";
    "D input - data input"
    "T input - trigger new sequential file creation"
    "";
    "File type:";
    "   1 - CSV";
    "   2 - Binary";
    "";
    "Mode:";
    "   1 - Create";
    "   2 - Append";
    "";
    "Enter To File block parameters:"];

    select job
    case 'set' then
        x=arg1
        model=arg1.model;graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,file_name, filt_type, file_mode, vec_size,exprs]=..
                scicos_getvalue(to_file_desc,..
                ['File name:';
                'File type:';
                'Mode:';
                'Vector size:'],..
                list('str',1,'vec',1,'vec',1,'vec',1),exprs)
            catch
                getversion('scilab');
                [ok,file_name, filt_type, file_mode, vec_size,exprs]=..
                scicos_getvalue(to_file_desc,..
                ['File name:';
                'File type:';
                'Mode:';
                'Vector size:'],..
                list('str',1,'vec',1,'vec',1,'vec',1),exprs)
            end;

            if ~ok then break,end

            if filt_type > 2 | filt_type < 1 then
                ok = %f;
                message("Wrong file type, use 1 or 2!");
            end

            if file_mode > 2 | file_mode < 1 then
                ok = %f;
                message("Wrong mode, select 1 or 2!");
            end

            if length(file_name) > 64 then
                ok = %f;
                message("File name too long - 64 character max!");
            end

            if vec_size > 8 then
                ok = %f;
                message("Wrong vector size - 8 max!");
            end

            if ok then
                [model,graphics,ok]=check_io(model,graphics,[vec_size 1],[],1,[])
                graphics.exprs=exprs;
                model.rpar=[]
                model.ipar=[filt_type;file_mode;0;vec_size;0;ascii(file_name)';0];
                model.dstate=[];
                x.graphics=graphics;x.model=model
                break
            end
        end
    case 'define' then
        file_name='data.csv'
        filt_type = 1;
        file_mode = 1;
        vec_size = 1;
        model=scicos_model()
        model.sim=list('mdaq_to_file_sim',5)
        model.in = [1; 1]
        model.in2=[1; 1]
        model.intyp=[1; 1]
        model.out=[]
        model.evtin=1
        model.rpar=[]
        model.ipar=[filt_type;file_mode;0;vec_size;0;ascii(file_name)';0]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(file_name);sci2exp(filt_type);sci2exp(file_mode);sci2exp(vec_size)]
        gr_i=['xstringb(orig(1),orig(2),['''';file_name],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=%1$s;fontColor=#5f5f5f"]
        x.graphics.in_label = ["D"; "T"];
        x.graphics.exprs=exprs;
    end
endfunction

function [x,y,typ] = mdaq_to_file(job,arg1,arg2)
    x=[];y=[];typ=[];

    to_file_desc = [ "To File block";
    "";
    "This block writes data to file. Files are created on user disk in";
    "''dsp/data'' directory. Files can be downloaded with web browser or";
    "mass storage interface. ";
    "";
    "In order to import file data to Scilab mdaqFileData script can be used.";
    "See mdaqFileData help for more info.";
    "";
    "Data can be written to file in text of binary format. Depending ";
    "on selected option data can appended to previous content of the file";
    "or data will be written to empty file (Create option)";
    "To avoid time time consuming wirte operation during every";
    "simulation step block can buffer data.";
    "";
    "Rising edge on Trigger input(2) will create new file. To define sequential file";
    "name use ''%d'' e.g. data_%d.txt will produce files data_0.txt, data_1.txt,...";
    "If ''%d'' isn''t included in file name data will be written to one file.";
    "";
    "Trigger input has to be connected with a signal, if a sequential file is ";
    "not used, the constant block with value 1 shall be connected.";
    "";
    "D input - data input"
    "T input - trigger new sequential file creation"
    "";
    "Filt type:";
    "   1 - Text";
    "   2 - Binary";
    "";
    "Mode:";
    "   1 - Create";
    "   2 - Append";
    "";
    "Enter To File block parameters:"];

    select job
    case 'set' then
        x=arg1
        model=arg1.model;graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,file_name, filt_type, file_mode, vec_size,exprs]=..
                scicos_getvalue(to_file_desc,..
                ['File name:';
                'File type:';
                'Mode:';
                'Vector size:'],..
                list('str',1,'vec',1,'vec',1,'vec',1),exprs)
            catch
                getversion('scilab');
                [ok,file_name, filt_type, file_mode, vec_size,exprs]=..
                scicos_getvalue(to_file_desc,..
                ['File name:';
                'File type:';
                'Mode:';
                'Vector size:'],..
                list('str',1,'vec',1,'vec',1,'vec',1),exprs)
            end;

            if ~ok then break,end

            if filt_type > 2 | filt_type < 1 then
                ok = %f;
                message("Wrong file type, use 1 or 2!");
            end

            if file_mode > 2 | file_mode < 1 then
                ok = %f;
                message("Wrong mode, select 1 or 2!");
            end

            if length(file_name) > 64 then
                ok = %f;
                message("File name too long - 64 character max!");
            end

//            if vec_buff_size > 500 then
//                ok = %f;
//                message("Wrong vector buffer size - 500 max!");
//            end

            if vec_size > 8 then
                ok = %f;
                message("Wrong vector size - 8 max!");
            end

            if ok then
                [model,graphics,ok]=check_io(model,graphics,[vec_size 1],[],1,[])
                graphics.exprs=exprs;
                model.rpar=[]
                model.ipar=[filt_type;file_mode;0;vec_size;0;ascii(file_name)';0];
                model.dstate=[];
                x.graphics=graphics;x.model=model
                break
            end
        end
    case 'define' then
        file_name='data.txt'
        filt_type = 1;
        file_mode = 1;
        vec_buff_size = 100;
        vec_size = 1;

        model=scicos_model()
        model.sim=list('mdaq_to_file_sim',5)
        model.in = [1; 1]
        model.in2=[1; 1]
        model.intyp=[1; 1]
        model.out=[]
        model.evtin=1
        model.rpar=[]
        model.ipar=[filt_type;file_mode;0;vec_size;0;ascii(file_name)';0]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(file_name);sci2exp(filt_type);sci2exp(file_mode);sci2exp(vec_size)]
        gr_i=['xstringb(orig(1),orig(2),['''';file_name],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=%1$s;fontColor=#5f5f5f"]
        x.graphics.in_label = ["D"; "T"];
        x.graphics.exprs=exprs;
    end
endfunction


direct output

direct output

location = 'C:\cygwin\home\Zhan\repository\graph-classifier\dataset\'
cdf1_file = 'inDegC.ba-12-8.txt.tab'
cdf2_file = 'inDegC.ba-11-8.txt.tab'

mode(-1)

cdf_raw = fscanfMat(location + cdf1_file)
l = size(cdf_raw, 1), i_last = 1
for r = 1:l
  i = cdf_raw(r, 1), v = cdf_raw(r, 2)
  for j = i_last:i, cdf1(j) = v, end
  i_last = i
end

clear cdf_raw

cdf_raw = fscanfMat(location + cdf2_file)
l = size(cdf_raw, 1), i_last = 1
for r = 1:l
  i = cdf_raw(r, 1), v = cdf_raw(r, 2)
  for j = i_last:i, cdf2(j) = v, end
  i_last = i
end

clear cdf_raw l r i i_last j v

cdf1=gsort(cdf1, 'g', 'i')
cdf2=gsort(cdf2, 'g', 'i')

i1 = 1, fn1 = 0, l1 = size(cdf1, 1)
i2 = 1, fn2 = 0, l2 = size(cdf2, 1)
d = 0
while (i1 <= l1) & (i2 <= l2)
  d1 = cdf1(i1)
  d2 = cdf2(i2)
  if d1 <= d2 then i1 = i1 + 1, fn1 = i1 / l1; end
  if d2 <= d1 then i2 = i2 + 1, fn2 = i2 / l2; end
  d0 = abs(fn2 - fn1)
  if d0 > d then d = d0; end
end

clear i1 i2 fn1 fn2 d0 d1 d2

en = sqrt(l1 * l2/(l1 + l2))

alam = (en + 0.12 + 0.11 / en) * d
eps1 = 0.001, eps2 = 1.0e-8, fac = 2, s = 0, term_bf = 0, ks_significance = 1
a2 = -2.0 * alam * alam
for i = 1:100
  term = fac * exp(a2 * i * i)
  s = s + term
  if (abs(term) <= eps1 * term_bf) | (abs(term) <= eps2 * s) then
    ks_significance = s
    break
  end
  fac = -fac
  term_bf = abs(term)
end

clear en l1 l2 alam eps1 eps2 fac s term_bf a2 i term

mode(0)

mprintf("%s -- %s: %f %f%c\n", cdf1_file, cdf2_file, d, ks_significance * 100, '%')

clear cdf1_file cdf2_file

location = 'C:\cygwin\home\Zhan\repository\graph-classifier\dataset\'
cdf1_file = 'inDegC.rmat-12-8.txt.tab'
cdf2_file = 'inDegC.rmat-8-8.txt.tab'

mode(-1)

cdf_raw = fscanfMat(location + cdf1_file)
l = size(cdf_raw, 1), i_last = 1
for r = 1:l
  i = cdf_raw(r, 1), v = cdf_raw(r, 2)
  for j = i_last:i, cdf1(j) = v, end
  i_last = i
end

clear cdf_raw

cdf_raw = fscanfMat(location + cdf2_file)
l = size(cdf_raw, 1), i_last = 1
for r = 1:l
  i = cdf_raw(r, 1), v = cdf_raw(r, 2)
  for j = i_last:i, cdf2(j) = v, end
  i_last = i
end

clear cdf1_file cdf2_file cdf_raw l r i i_last j v

cdf1=gsort(cdf1, 'g', 'i')
cdf2=gsort(cdf2, 'g', 'i')

i1 = 1, fn1 = 0, l1 = size(cdf1, 1)
i2 = 1, fn2 = 0, l2 = size(cdf2, 1)
d = 0
while (i1 <= l1) & (i2 <= l2)
  d1 = cdf1(i1)
  d2 = cdf2(i2)
  if d1 <= d2 then i1 = i1 + 1, fn1 = i1 / l1; end
  if d2 <= d1 then i2 = i2 + 1, fn2 = i2 / l2; end
  d0 = abs(fn2 - fn1)
  if d0 > d then d = d0; end
end

clear i1 i2 fn1 fn2 d0 d1 d2

en = sqrt(l1 * l2/(l1 + l2))

alam = (en + 0.12 + 0.11 / en) * d
eps1 = 0.001, eps2 = 1.0e-8, fac = 2, s = 0, term_bf = 0, ks_significance = 1
a2 = -2.0 * alam * alam
for i = 1:100
  term = fac * exp(a2 * i * i)
  s = s + term
  if (abs(term) <= eps1 * term_bf) | (abs(term) <= eps2 * s) then
    ks_significance = s
    break
  end
  fac = -fac
  term_bf = abs(term)
end

clear en l1 l2 alam eps1 eps2 fac s term_bf a2 i term

mode(0)


Fix link_id variable

Fix link_id variable

function [data] = mdaqDSPTaskRead(arg1, arg2, arg3, arg4, arg5)
    // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaqDSPSignalRead');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    if argn(2) == 4 then
        signalID = arg1;
        vectorSize = arg2;
        vectorCount = arg3;
        timeout  = arg4;
    end

    if argn(2) == 5 then
        link_id = arg1;
        signalID = arg2;
        vectorSize = arg3;
        vectorCount = arg4;
        timeout  = arg5;

        if link_id < 0 then
            error("Invalid connection ID!")
            return;
        end
    end

    data = [];
    result = -1;

    if argn(2) <> 4 & argn(2) <> 5 then
        mprintf("Description:\n");
        mprintf("\tReads DSP task data\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqDSPTaskRead(linkId, signalId, vectorSize, vectorCount, timeout);\n")
        mprintf("\tlinkId - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tsignalId - signal block identification number from XCOS model.\n");
        mprintf("\tvectorSize - SIGNAL block input vector size.\n");
        mprintf("\tvectorCount - number of vectors to read.\n");
        mprintf("\ttimeout - timeout in seconds\n");
        return;
    end

    if timeout < 0 then
        timeout = -1;
    end

    if timeout > 0 then
        timeout = timeout * 1000;
    end

    if argn(2) == 4 then
        link_id = mdaqOpen();
        if link_id < 0  then
            error(mdaq_error2(link_id), 10000 + abs(link_id));
        end
    end

    [data result] = call("sci_mlink_dsp_signal_read",..
                            link_id, 1, "i",..
                            signalID, 2, "i",..
                            vectorSize, 3, "i",..
                            vectorSize*vectorCount, 5, "i",..
                            timeout, 6, "i",..
                        "out",..
                            [vectorSize, vectorCount], 4, "d",..
                            [1, 1], 7, "i");
    if argn(2) == 4 then
        mdaqClose(link_id);
    end

    if result < 0  then
        error(mdaq_error2(result), 10000 + abs(result));
    end

    data = data';
endfunction

function [data] = mdaqDSPTaskRead(arg1, arg2, arg3, arg4, arg5)
    // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaqDSPSignalRead');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    if argn(2) == 4 then
        signalID = arg1;
        vectorSize = arg2;
        vectorCount = arg3;
        timeout  = arg4;
    end

    if argn(2) == 5 then
        link_id = arg1;
        signalID = arg2;
        vectorSize = arg3;
        vectorCount = arg4;
        timeout  = arg5;

        if link_id < 0 then
            error("Invalid connection ID!")
            return;
        end
    end

    data = [];
    result = -1;

    if argn(2) <> 4 & argn(2) <> 5 then
        mprintf("Description:\n");
        mprintf("\tReads DSP task data\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqDSPTaskRead(linkId, signalId, vectorSize, vectorCount, timeout);\n")
        mprintf("\tlinkId - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tsignalId - signal block identification number from XCOS model.\n");
        mprintf("\tvectorSize - SIGNAL block input vector size.\n");
        mprintf("\tvectorCount - number of vectors to read.\n");
        mprintf("\ttimeout - timeout in seconds\n");
        return;
    end

    if timeout < 0 then
        timeout = -1;
    end

    if timeout > 0 then
        timeout = timeout * 1000;
    end

    if argn(2) == 4 then
        link_id = mdaqOpen();
        if link_id < 0  then
            error(mdaq_error2(link_id), 10000 + abs(link_id));
        end
    end

    [data result] = call("sci_mlink_dsp_signal_read",..
                            link_fd, 1, "i",..
                            signalID, 2, "i",..
                            vectorSize, 3, "i",..
                            vectorSize*vectorCount, 5, "i",..
                            timeout, 6, "i",..
                        "out",..
                            [vectorSize, vectorCount], 4, "d",..
                            [1, 1], 7, "i");
    if argn(2) == 4 then
        mdaqClose(link_id);
    end

    if result < 0  then
        error(mdaq_error2(result), 10000 + abs(result));
    end

    data = data';
endfunction


disable scs' subsequenttests that use binfilter formats


sb120: #i111285# disabled failing tests for now

-o forms.OButtonControl
#i111285 -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
#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


Delete loader.sce

Delete loader.sce

// This file is released under the 3-clause BSD license. See COPYING-BSD.
// Generated by builder.sce: Please, do not edit this file

try
 getversion("scilab");
catch
 error("Scilab 5.0 or more is required.");
end;

exec(get_absolute_file_path("loader.sce")+"etc"+filesep()+"microdaq.start");


Close connection when loading last DSP image - load_last_dsp_image

function load_last_dsp_image()
    global %microdaq;
    res = 0;

    if isfile(TMPDIR + filesep() + "last_mdaq_dsp_image") == %t then
        dsp_app_path = mgetl(TMPDIR + filesep() + "last_mdaq_dsp_image");
        if isfile(dsp_app_path) == %t then
            connection_id = mdaq_open();
            if connection_id < 0 then
                message('Unable to locate MicroDAQ device - check your setup!');
                return;
            end

            disp('### Loading model to MicroDAQ...');
            res = mlink_dsp_load(connection_id, dsp_app_path, '');
            if res < 0 then
                // try again to load application
                mdaq_close(connection_id);
                connection_id = mdaq_open();
                if connection_id < 0 then
                    message('ERROR: Unable to locate MicroDAQ device - check your setup!');
                    return;
                end
                res = mlink_dsp_load(connection_id, dsp_app_path, '');
                if res < 0 then
                    message('Unable to load DSP firmware!');
                    mdaq_close(connection_id);
                    %microdaq.dsp_loaded = %F
                    return;
                end
            end

            disp('### Starting model on MicroDAQ...');
            res = mlink_dsp_start(connection_id);
            if res < 0 then
                message("Unable to start DSP application!");
                mdaq_close(connection_id);
                %microdaq.dsp_loaded = %F;
                return;
            end
            %microdaq.dsp_loaded = %T;
            mdaq_close(connection_id);
        else
            message("Unable to find model, build model and try again!")
        end
    else
        message("Unable to find model, build model and try again!")
    end
endfunction

function load_last_dsp_image()
    global %microdaq;
    if isfile(TMPDIR + filesep() + "last_mdaq_dsp_image") == %t then
        dsp_app_path = mgetl(TMPDIR + filesep() + "last_mdaq_dsp_image");
        if isfile(dsp_app_path) == %t then
            connection_id = mdaq_open();
            if connection_id < 0 then
                message('Unable to locate MicroDAQ device - check your setup!');
                return;
            end

            disp('### Loading model to MicroDAQ...');
            res = mlink_dsp_load(connection_id, dsp_app_path, '');
            if res < 0 then
                // try again to load application
                mdaq_close(connection_id);
                connection_id = mdaq_open();
                if connection_id < 0 then
                    message('ERROR: Unable to locate MicroDAQ device - check your setup!');
                    return;
                end
                res = mlink_dsp_load(connection_id, dsp_app_path, '');
                if res < 0 then
                    message('Unable to load DSP firmware!');
                    mdaq_close(connection_id);
                    %microdaq.dsp_loaded = %F
                    return;
                end
            end

            disp('### Starting model on MicroDAQ...');
            res = mlink_dsp_start(connection_id);
            if res < 0 then
                message("Unable to start DSP application!");
                mdaq_close(connection_id);
                %microdaq.dsp_loaded = %F;
                return;
            end
            %microdaq.dsp_loaded = %T;

        else
            message("Unable to find model, build model and try again!")
        end
    else
        message("Unable to find model, build model and try again!")
    end
endfunction


Add limb data: length, mass, radius of gyration, moment of inertia

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

global PI
PI = 3.1415

global DELTA_T
DELTA_T = 0.02

proband_mass = 83

cwd = get_absolute_file_path('main.sce')
getd(cwd);

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

// For testing only
data_path = cwd + "/../data/Laufen/felix/laufband/4/4.mdf"

// READ DATA

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

// Create Limbs

foot = CalcCoM(ankle, toes, 0.5)
leg = CalcCoM(knee, ankle, 0.433)
thigh = CalcCoM(hip, knee, 0.433)
leg_total = CalcCoM(hip, ankle, 0.447)
upperarm = CalcCoM(shoulder, elbow, 0.436)
forearm = CalcCoM(elbow, hand, 0.430)
arm_total = CalcCoM(shoulder, hand, 0.5) // Nicht ganz richtig, da anthro Daten zwischen Ellenbogen und Finger anliegen
trunk = CalcCoM(shoulder, hip, 0.5)

// Add masses

foot.mass = 0.0145 * proband_mass
leg.mass = 0.0465 * proband_mass
thigh.mass = 0.100 * proband_mass
leg_total.mass = 0.161 * proband_mass
upperarm.mass = 0.027 * proband_mass
forearm.mass = 0.016 * proband_mass
arm_total.mass = 0.050 * proband_mass
trunk.mass = 0.497 * proband_mass

// Add limb lengths

foot.length = mean(GetLimbLength(ankle, toes))
leg.length = mean(GetLimbLength(knee, ankle))
thigh.length = mean(GetLimbLength(hip, knee))
leg_total.length = mean(GetLimbLength(hip, ankle))
upperarm.length = mean(GetLimbLength(shoulder, elbow))
forearm.length = mean(GetLimbLength(elbow, hand))
arm_total.length = mean(GetLimbLength(shoulder, hand))
trunk.length = mean(GetLimbLength(shoulder, hip))

// Add radii of gyration

foot.RoG = foot.length * 0.475
leg.RoG = leg.length * 0.302
thigh.RoG = thigh.length * 0.323
leg_total.RoG = leg_total.length * 0.326
upperarm.RoG = upperarm.length * 0.322
forearm.RoG = forearm.length * 0.302
arm_total.RoG = arm_total.length * 0.368

// Add moments of inertia

foot.MoI = foot.mass * foot.RoG^2
leg.MoI = leg.mass * leg.RoG^2
thigh.MoI = thigh.mass * thigh.RoG^2
leg_total.MoI = leg_total.mass * leg_total.RoG^2
upperarm.MoI = upperarm.mass * upperarm.RoG^2
forearm.MoI = forearm.mass * forearm.RoG^2
arm_total.MoI = arm_total.mass * arm_total.RoG^2

// Calc Pendulum

Pendulum_T = 2 * PI * sqrt(mean(GetLimbLength(leg_total, hip)) / 9.81)

Lauf_T = size(ankle.x, 1) * DELTA_T

disp(Pendulum_T)
disp(Lauf_T)

// ANALYZE DATA

toes.speed = CalcSpeed(toes)
ankle.speed = CalcSpeed(ankle)
knee.speed = CalcSpeed(knee)
hip.speed = CalcSpeed(hip)
shoulder.speed = CalcSpeed(shoulder)
elbow.speed = CalcSpeed(elbow)
hand.speed = CalcSpeed(hand)
neck.speed = CalcSpeed(neck)

// smooth data

// PLOT DATA

//drawStickFigure()

// Leon writes functions

// Statistics? Correlation

// WRITE RESULTS
// Make results directory
// Save results as text files / Images

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

global PI
PI = 3.1415

global DELTA_T
DELTA_T = 0.02

proband_mass = 83

cwd = get_absolute_file_path('main.sce')
getd(cwd);

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

// For testing only
data_path = cwd + "/../data/Laufen/felix/laufband/4/4.mdf"

// READ DATA

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

// Create Limbs

foot = CalcCoM(ankle, toes, 0.5)
leg = CalcCoM(knee, ankle, 0.433)
thigh = CalcCoM(hip, knee, 0.433)
leg_total = CalcCoM(hip, ankle, 0.447)
upperarm = CalcCoM(shoulder, elbow, 0.436)
forearm = CalcCoM(elbow, hand, 0.430)
arm_total = CalcCoM(shoulder, hand, 0.5) // Nicht ganz richtig, da anthro Daten zwischen Ellenbogen und Finger anliegen
trunk = CalcCoM(shoulder, hip, 0.5)

// Add masses

foot.mass = 0.0145 * proband_mass
leg.mass = 0.0465 * proband_mass
thigh.mass = 0.100 * proband_mass
leg_total.mass = 0.161 * proband_mass
upperarm.mass = 0.027 * proband_mass
forerarm.mass = 0.016 * proband_mass
arm_total.mass = 0.050 * proband_mass
trunk.mass = 0.497 * proband_mass

// Calc Pendulum

Pendulum_T = 2 * PI * sqrt(mean(GetLimbLength(leg_total, hip)) / 9.81)

Lauf_T = size(ankle.x, 1) * DELTA_T

disp(Pendulum_T)
disp(Lauf_T)

// ANALYZE DATA

toes.speed = CalcSpeed(toes)
ankle.speed = CalcSpeed(ankle)
knee.speed = CalcSpeed(knee)
hip.speed = CalcSpeed(hip)
shoulder.speed = CalcSpeed(shoulder)
elbow.speed = CalcSpeed(elbow)
hand.speed = CalcSpeed(hand)
neck.speed = CalcSpeed(neck)

// smooth data

// PLOT DATA

//drawStickFigure()

// Leon writes functions

// Statistics? Correlation

// WRITE RESULTS
// Make results directory
// Save results as text files / Images


Correct AI channel number in diff mode

Correct AI channel number in diff mode

function data = mdaq_ai_read(arg1, arg2, arg3, arg4)
    data = [];
    link_id = -1;

    if argn(2) == 3 then
        channels = arg1;
        ai_range = arg2;
        differential = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        channels = arg2;
        ai_range = arg3;
        differential = arg4;
        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        adc_info = get_adc_info(%microdaq.private.mdaq_hwid);
        if argn(2) > 4 | argn(2) < 3 then
            mprintf("Description:\n");
            mprintf("\tReads MicroDAQ analog inputs\n");
            mprintf("Usage:\n");
            mprintf("\tmdaq_ai_read(link_id, channels, range, differential);\n")
            mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
            mprintf("\tchannels - analog input channels to read\n");
            mprintf("\trange - analog input range:\n");
            for i = 1:size(adc_info.c_params.c_range_desc, "r")
                mprintf("\t    %s\n", string(i) + ": " + adc_info.c_params.c_range_desc(i));
            end
            mprintf("\tdifferential - measurement type (%%T - differential, %%F - single-ended)\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaq_hwinfo and try again!');
        return;
    end

    adc_ch_count = strtod(adc_info.channel);
    if differential then
        adc_ch_count = adc_ch_count / 2;
    end

    ch_count = max(size(channels));
    if ch_count < 1 | ch_count > adc_ch_count then
        disp("ERROR: Wrong AI channel selected!")
        return;
    end

    if max(channels) > adc_ch_count | min(channels) < 1 then
        disp("ERROR: Wrong AI channel selected!")
        return;
    end

    if argn(2) == 3 then
        link_id = mdaq_open();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end
    bipolar = adc_info.c_params.c_bipolar(ai_range);
    ai_range = adc_info.c_params.c_range(ai_range);

    if differential == %T then
        differential = 29;
    else
        differential = 28;
    end

    result = [];
    [data result] = call("sci_mlink_ai_read",..
                        link_id, 1, "i",..
                        channels, 2, "i",..
                        ch_count, 3, "i",..
                        ai_range, 4, "i",..
                        bipolar, 5, "i",..
                        differential, 6, "i",..
                    "out",..
                        [1, ch_count], 7, "d",..
                        [1, 1], 8, "i");

    if result < 0 then
        mdaq_error(result);
    end

    if argn(2) == 3 then
        mdaq_close(link_id);
    end
endfunction

function data = mdaq_ai_read(arg1, arg2, arg3, arg4)
    data = [];
    link_id = -1;

    if argn(2) == 3 then
        channels = arg1;
        ai_range = arg2;
        differential = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        channels = arg2;
        ai_range = arg3;
        differential = arg4;
        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        adc_info = get_adc_info(%microdaq.private.mdaq_hwid);
        adc_ch_count = strtod(adc_info.channel);
        if differential then
            adc_ch_count = adc_ch_count / 2;
        end

        if argn(2) > 4 | argn(2) < 3 then
            mprintf("Description:\n");
            mprintf("\tReads MicroDAQ analog inputs\n");
            mprintf("Usage:\n");
            mprintf("\tmdaq_ai_read(link_id, channels, range, differential);\n")
            mprintf("\tlink_id - connection id returned by mdaq_open() (OPTIONAL)\n");
            mprintf("\tchannels - analog input channels to read\n");
            mprintf("\trange - analog input range:\n");
            for i = 1:size(adc_info.c_params.c_range_desc, "r")
                mprintf("\t    %s\n", string(i) + ": " + adc_info.c_params.c_range_desc(i));
            end
            mprintf("\tdifferential - measurement type (%%T - differential, %%F - single-ended)\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ confituration - run mdaq_hwinfo and try again!');
        return;
    end

    ch_count = max(size(channels));
    if ch_count < 1 | ch_count > adc_ch_count then
        disp("ERROR: Wrong AI channel selected!")
        return;
    end

    if max(channels) > adc_ch_count | min(channels) < 1 then
        disp("ERROR: Wrong AI channel selected!")
        return;
    end

    if argn(2) == 3 then
        link_id = mdaq_open();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end
    bipolar = adc_info.c_params.c_bipolar(ai_range);
    ai_range = adc_info.c_params.c_range(ai_range);

    if differential == %T then
        differential = 29;
    else
        differential = 28;
    end

    result = [];
    [data result] = call("sci_mlink_ai_read",..
                        link_id, 1, "i",..
                        channels, 2, "i",..
                        ch_count, 3, "i",..
                        ai_range, 4, "i",..
                        bipolar, 5, "i",..
                        differential, 6, "i",..
                    "out",..
                        [1, ch_count], 7, "d",..
                        [1, 1], 8, "i");

    if result < 0 then
        mdaq_error(result);
    end

    if argn(2) == 3 then
        mdaq_close(link_id);
    end
endfunction


fix for SCHEDULING-323

fix for SCHEDULING-323

git-svn-id: 27916816d6cfa57849e9a885196bf7392b80e1ac@12929 28e8926c-6b08-0410-baaa-805c5e19b8d6

function [] = PAinit()

     global PA_initialized

     version = ver();
     if strtod(part(version(1,2),1)) < 5
         error('This toolkit cannot be run on a version of Scilab anterior to version 5');
     end

     try
         schedulerdir = getenv('SCHEDULER_HOME');
     catch
         error('The environment variable SCHEDULER_HOME must be defined, use setenv to define it in Scilab');
     end

     if ~isdir(schedulerdir)
         error(strcat(['The path "',schedulerdir,'" doesn''t exist or is not a directory']));
     end
     schedjar = fullfile(schedulerdir,'dist','lib','ProActive_Scheduler-core.jar');
     if length(fileinfo(schedjar)) == 0
         error(strcat(['Can''t locate the scheduler jar at ""';schedjar;'"" , please make sure that SCHEDULER_HOME refers to the correct directory.']));
     end

     sep=pathsep();

     // Add ProActive Scheduler to the scilab classpath
     initcp = javaclasspath();

     cp = [fullfile(schedulerdir,'dist','lib','ProActive_ResourceManager.jar'); initcp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive_Scheduler-core.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive_SRM-common.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','javasci.jar'); cp];
     javaclasspath(cp);

     // Call the native JNI connection to the Scheduler classes
     initEmbedded();

     PA_initialized = 1;
     predef(1);

     endfunction

function [] = PAinit()

     global PA_initialized

     version = ver();
     if strtod(part(version(1,2),1)) < 5
         error('This toolkit cannot be run on a version of Scilab anterior to version 5');
     end

     try
         schedulerdir = getenv('SCHEDULER_HOME');
     catch
         error('The environment variable SCHEDULER_HOME must be defined, use setenv to define it in Scilab');
     end

     if ~isdir(schedulerdir)
         error(strcat(['The path "',schedulerdir,'" doesn't exist or is not a directory']));
     end
     schedjar = fullfile(schedulerdir,'dist','lib','ProActive_Scheduler-core.jar');
     if length(fileinfo(schedjar)) == 0
         error(strcat(['Can''t locate the scheduler jar at ""';schedjar;'"" , please make sure that SCHEDULER_HOME refers to the correct directory.']));
     end

     sep=pathsep();

     // Add ProActive Scheduler to the scilab classpath
     initcp = javaclasspath();

     cp = [fullfile(schedulerdir,'dist','lib','ProActive_ResourceManager.jar'); initcp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive_Scheduler-core.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive_SRM-common.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','ProActive.jar'); cp];
     cp = [fullfile(schedulerdir,'dist','lib','javasci.jar');cp];
     javaclasspath(cp);

     // Call the native JNI connection to the Scheduler classes
     initEmbedded();

     PA_initialized = 1;
     predef(1);

     endfunction


Normale snelheid geen filter

Normale snelheid geen filter


sb120: #i111102# 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
-o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
-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

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
-o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
-o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
-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


INTEGRATION: CWS cwscheckapi2 (1.8.88); FILE MERGED 2008/07/18 20:32:27 cn 1.8.88.1: #i91719# update lists

#i91828 -o svx.AccessibleControlShape
#i91828 -o svx.AccessibleEditableTextPara
#i91828 -o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
#i91828 -o svx.AccessibleOLEShape
#i91828 -o svx.AccessiblePageShape
#i91828 -o svx.AccessiblePresentationGraphicShape
#i91828 -o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
#i91828 -o svx.AccessibleShape
#i90294 -o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
#i87746 -o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
#i87746 -o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
#i87746 -o svx.SvxShapeControl
#i87746 -o svx.SvxShapeDimensioning
#i87746 -o svx.SvxShapeGroup
#i87746 -o svx.SvxShapePolyPolygon
#i87746 -o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration

-o svx.AccessibleControlShape
-o svx.AccessibleEditableTextPara
-o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
-o svx.AccessibleOLEShape
-o svx.AccessiblePageShape
-o svx.AccessiblePresentationGraphicShape
-o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
-o svx.AccessibleShape
#i90294 -o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
#i87746 -o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
#i87746 -o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
#i87746 -o svx.SvxShapeControl
#i87746 -o svx.SvxShapeDimensioning
#i87746 -o svx.SvxShapeGroup
#i87746 -o svx.SvxShapePolyPolygon
#i87746 -o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration


Fix wrong range value 1.24 -> 1.28

Fix wrong range value 1.24 -> 1.28


INTEGRATION: CWS fwk21 (1.5.580); FILE MERGED 2005/09/13 13:37:59 cn 1.5.580.1: #i54553# update

# test works on windows with cws tl12 except swXMailMerge and SwXMLImporter
# but this could be a problem of the NONPRO-Version

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
-o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
-o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
-o sw.SwAccessibleTableView
-o sw.SwAccessibleTextEmbeddedObject
-o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
# i41735#-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
-o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
-o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
-o sw.SwXTextDefaults
-o sw.SwXTextDocument
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
-o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
-o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
-o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
-o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
-o sw.XMLStylesImporter
-o sw.DocumentSettings

-o sw.CharacterStyle
-o sw.ConditionalParagraphStyle
-o sw.PageStyle
-o sw.ParagraphStyle
-o sw.SwAccessibleDocumentPageView
-o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
-o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
-o sw.SwAccessibleTableView
-o sw.SwAccessibleTextEmbeddedObject
-o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
-o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
-o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
-o sw.SwXTextDefaults
-o sw.SwXTextDocument
#binfilter-o sw.SwXTextEmbeddedObject
#binfilter-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrame
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObject
-o sw.SwXTextGraphicObjects
-o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
-o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
-o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
-o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
-o sw.XMLStylesImporter
-o sw.DocumentSettings


opmaak

opmaak

[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('lp',80,[750/Fs 0],'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');


INTEGRATION: CWS qadev32 (1.4.14); FILE MERGED 2008/04/16 18:04:18 cn 1.4.14.1: #i87216# update lists

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
-o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
-o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
-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

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
-o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
-o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
-o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
-o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
-o xmloff.Impress.XMLSettingsExporter
-o xmloff.Impress.XMLSettingsImporter
-o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter


INTEGRATION: CWS unoapi1 (1.3.206); FILE MERGED 2007/08/16 07:42:32 cn 1.3.206.1: #i79479# update lists

-o cfgmgr2.LocalSchemaSupplier
-o cfgmgr2.LocalSingleStratum
-o cfgmgr2.MultiStratumBackend
-o sysmgr1.SystemIntegration
#-o cfgmgr2.BootstrapContext
-o cfgmgr2.LayerUpdateMerger
-o cfgmgr2.LayerWriter
-o cfgmgr2.LocalDataImporter
-o cfgmgr2.LocalHierarchyBrowser
-o cfgmgr2.LocalSingleBackend
-o cfgmgr2.MergeImporter
-o cfgmgr2.OConfigurationRegistry
-o cfgmgr2.OInnerGroupInfoAccess
-o cfgmgr2.OInnerGroupUpdateAccess
-o cfgmgr2.OInnerSetInfoAccess
#-o cfgmgr2.OInnerTreeSetUpdateAccess
#-o cfgmgr2.OInnerValueSetUpdateAccess
-o cfgmgr2.ORootElementGroupInfoAccess
-o cfgmgr2.ORootElementGroupUpdateAccess
-o cfgmgr2.ORootElementSetInfoAccess
#-o cfgmgr2.ORootElementTreeSetUpdateAccess
#-o cfgmgr2.ORootElementValueSetUpdateAccess
-o cfgmgr2.OSetElementGroupInfoAccess
-o cfgmgr2.OSetElementGroupUpdateAccess
-o cfgmgr2.OSetElementSetInfoAccess
#-o cfgmgr2.OSetElementTreeSetUpdateAccess
### 112549 ###-o cfgmgr2.OSetElementValueSetUpdateAccess
-o cfgmgr2.SchemaParser
-o cfgmgr2.SingleBackendAdapter
-o cfgmgr2.ConfigurationProviderWrapper
-o cfgmgr2.LayerParser
-o cfgmgr2.CopyImporter
-o cfgmgr2.AdministrationProvider
-o cfgmgr2.ConfigurationProvider

-o cfgmgr2.LocalSchemaSupplier
-o cfgmgr2.LocalSingleStratum
-o cfgmgr2.MultiStratumBackend
-o sysmgr1.SystemIntegration
-o cfgmgr2.BootstrapContext
-o cfgmgr2.LayerUpdateMerger
-o cfgmgr2.LayerWriter
-o cfgmgr2.LocalDataImporter
-o cfgmgr2.LocalHierarchyBrowser
-o cfgmgr2.LocalSingleBackend
-o cfgmgr2.MergeImporter
-o cfgmgr2.OConfigurationRegistry
-o cfgmgr2.OInnerGroupInfoAccess
-o cfgmgr2.OInnerGroupUpdateAccess
-o cfgmgr2.OInnerSetInfoAccess
-o cfgmgr2.OInnerTreeSetUpdateAccess
-o cfgmgr2.OInnerValueSetUpdateAccess
-o cfgmgr2.ORootElementGroupInfoAccess
-o cfgmgr2.ORootElementGroupUpdateAccess
-o cfgmgr2.ORootElementSetInfoAccess
-o cfgmgr2.ORootElementTreeSetUpdateAccess
-o cfgmgr2.ORootElementValueSetUpdateAccess
-o cfgmgr2.OSetElementGroupInfoAccess
-o cfgmgr2.OSetElementGroupUpdateAccess
-o cfgmgr2.OSetElementSetInfoAccess
-o cfgmgr2.OSetElementTreeSetUpdateAccess
### 112549 ###-o cfgmgr2.OSetElementValueSetUpdateAccess
-o cfgmgr2.SchemaParser
-o cfgmgr2.SingleBackendAdapter
-o cfgmgr2.ConfigurationProviderWrapper
-o cfgmgr2.LayerParser
-o cfgmgr2.CopyImporter
-o cfgmgr2.AdministrationProvider
-o cfgmgr2.ConfigurationProvider


INTEGRATION: CWS unoapi2 (1.3.10); FILE MERGED 2007/11/22 14:10:47 cn 1.3.10.1: #i83871# update list with issues

-o sch.ChXChartDocument
#i79073 -o sch.AccArea
#i79073 -o sch.AccAxis
#i79073 -o sch.AccDataPoint
#i79073 -o sch.AccDataSeries
#i79073 -o sch.AccDiagram
#i79073 -o sch.AccFloor
#i79073 -o sch.AccGrid
#i79073 -o sch.AccLegend
#i79073 -o sch.AccLegendEntry
#i79073 -o sch.AccStatisticsObject
#i79073 -o sch.AccTitle
#i79073 -o sch.AccWall
#i79073 -o sch.AccessibleDocumentView
-o sch.ChXChartAxis
-o sch.ChXChartData
-o sch.ChXChartDataArray
-o sch.ChXChartView
#i83867 -o sch.ChXDataPoint
#i83868 -o sch.ChXDataRow
-o sch.ChXDiagram
-o sch.ChartArea
-o sch.ChartGrid
-o sch.ChartLegend
-o sch.ChartLine
-o sch.ChartTitle

-o sch.ChXChartDocument
# -o sch.AccArea
# -o sch.AccAxis
# -o sch.AccDataPoint
# -o sch.AccDataSeries
# -o sch.AccDiagram
# -o sch.AccFloor
# -o sch.AccGrid
# -o sch.AccLegend
# -o sch.AccLegendEntry
# -o sch.AccStatisticsObject
# -o sch.AccTitle
# -o sch.AccWall
# -o sch.AccessibleDocumentView
-o sch.ChXChartAxis
-o sch.ChXChartData
-o sch.ChXChartDataArray
-o sch.ChXChartView
#-o sch.ChXDataPoint
#-o sch.ChXDataRow
-o sch.ChXDiagram
-o sch.ChartArea
-o sch.ChartGrid
-o sch.ChartLegend
-o sch.ChartLine
-o sch.ChartTitle


INTEGRATION: CWS qadev32 (1.7.22); FILE MERGED 2008/06/03 10:07:00 cn 1.7.22.2: #i87216# update lists 2008/04/16 18:06:18 cn 1.7.22.1: #i87216# update lists

-o svx.AccessibleControlShape
-o svx.AccessibleEditableTextPara
-o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
-o svx.AccessibleOLEShape
-o svx.AccessiblePageShape
-o svx.AccessiblePresentationGraphicShape
-o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
-o svx.AccessibleShape
#i90294 -o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
#i87746 -o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
#i87746 -o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
#i87746 -o svx.SvxShapeControl
#i87746 -o svx.SvxShapeDimensioning
#i87746 -o svx.SvxShapeGroup
#i87746 -o svx.SvxShapePolyPolygon
#i87746 -o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration

-o svx.AccessibleControlShape
-o svx.AccessibleEditableTextPara
-o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
-o svx.AccessibleOLEShape
-o svx.AccessiblePageShape
-o svx.AccessiblePresentationGraphicShape
-o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
-o svx.AccessibleShape
-o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
-o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
-o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
-o svx.SvxShapeControl
-o svx.SvxShapeDimensioning
-o svx.SvxShapeGroup
-o svx.SvxShapePolyPolygon
-o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration


mdaqAIScanInit - polish description

mdaqAIScanInit - polish description

function  mdaqAIScanInit(arg1, arg2, arg3, arg4, arg5, arg6)
    link_id = -1;

    if argn(2) == 5 then
        channels = arg1;
        aiRange = arg2;
        aiMode = arg3;
        scan_freq = arg4;
        scan_time = arg5;
    end

    if argn(2) == 6 then
        link_id = arg1;
        channels = arg2;
        aiRange = arg3;
        aiMode = arg4;
        scan_freq = arg5;
        scan_time = arg6;

        if link_id < 0 then
            error("Invalid connection ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        adc_info = get_adc_info(%microdaq.private.mdaq_hwid);
        if argn(2) > 6 | argn(2) < 5 then
            mprintf("Description:\n");
            mprintf("\tInitiates AI scanning session\n");
            mprintf("Usage:\n");
            mprintf("\tmdaqAIScanInit(linkID, channels, range, isDifferential, rate, duration)\n");
			mprintf("\tlinkID - connection id returned by mdaqOpen() (OPTIONAL)\n");
            mprintf("\tchannels - analog input channels to read\n");
            mprintf("\trange - analog input range matrix e.g.\n");
            mprintf("\t        [-10,10] - single range argument applied for all used channels\n");
            mprintf("\t        [-10,10;-5,5] - multi-range argument for two channels\n");
			mprintf("\tisDifferential - scalar or vector with measurement mode settings: %%T - differential, %%F - single-ended mode\n");
            mprintf("\trate - scans per second rate (scan frequency)\n");
            mprintf("\tduration - scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ configuration. Run mdaqHWInfo() function.');
    end

    ch_count = size(channels, 'c');

    if scan_time < 0 then
        scan_time = -1;
    end

    if size(channels, 'r') > 1 then
        error('Wrong channel - scalar or single row vector expected')
    end

    if size(aiRange, 'c') <> 2 then
        error('Wrong range - matrix range [low,high;low,high;...] expected')
    end

    aiRangeSize = size(aiRange, 'r');
    if aiRangeSize <> 1 & aiRangeSize <> ch_count then
        error('Range vector should match selected AI channels')
    end

    if type(aiMode) == 1 then
        if size(find(aiMode>1), '*') > 0
            error('Wrong mode - boolean value expected (%T/1, %F/0)')
        end
    end

    if size(aiMode, 'r') > 1 then
        error('Wrong mode - scalar or single row vector expected')
    end

    aiModeSize = size(aiMode, 'c');
    if aiModeSize <> 1 & aiModeSize <> ch_count then
        error('Mode vector should match selected AI channels')
    end

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

    aiRange_t = aiRange;
    aiRange = matrix(aiRange', 1, ch_count*2);

    aiMode(find(aiMode==%T))=1;
    if aiModeSize == 1 then
        aiMode = ones(1, ch_count) * aiMode;
    end

    if argn(2) == 5 then
        link_id = mdaqOpen();
        if link_id < 0 then
            error("Unable to connect to MicroDAQ device!");
        end
    end

    result = [];
    real_freq = scan_freq;
    [result real_freq] = call("sci_mlink_ai_scan_init",..
                    link_id, 1, "i",..
                    channels, 2, "i",..
                    ch_count, 3, "i",..
                    aiRange, 4, "d",..
                    aiMode, 5, "i",..
                    scan_freq, 6, "d",..
                    scan_time, 7, "d",..
                "out",..
                    [1, 1], 9, "i",..
                    [1, 1], 8, "d");

    if result < 0 & result <> -88 then
        if argn(2) == 5 then
            mdaqClose(link_id);
        end
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == -88 then
            disp("Warninng: AI scanning interrupted!")
            mdaqAIScanStop()

            // time to terminate TCP connection
            sleep(200);
            [result real_freq] = call("sci_mlink_ai_scan_init",..
                            link_id, 1, "i",..
                            channels, 2, "i",..
                            ch_count, 3, "i",..
                            aiRange, 4, "d",..
                            aiMode, 5, "i",..
                            scan_freq, 6, "d",..
                            scan_time, 7, "d",..
                        "out",..
                            [1, 1], 9, "i",..
                            [1, 1], 8, "d");
        end

        if argn(2) == 5 then
            mdaqClose(link_id);
        end

        if result < 0 then
            error(mdaq_error2(result), 10000 + abs(result));
        end

        if result == 1 then
            limited_cap = %t;
        else
            limited_cap = %f;
        end

        rows = [];
        row = '';

        adc_res = strtod(part(adc_info.resolution, 1:2))
        for j=1:ch_count
            if aiMode(j) == 1 then
                measure_type = "Differential"
            elseif (aiMode(j) == 0)
                measure_type = "Single-ended"
            end
            adc_range = aiRange_t(j, 2) - aiRange_t(j, 1);
            resolution = string((int(adc_range/2^adc_res * 1000000)) / 1000);
            rangeStr="";
            if aiRange_t(j, 1) < 0 then
                rangeStr = "±" + string(aiRange_t(j, 2))+"V";
            else
                rangeStr = "0-" + string(aiRange_t(j, 2))+"V";
            end
            rows = [rows; "AI"+string(channels(j)), measure_type, rangeStr, resolution+"mV"]
        end

        mprintf("\nAnalog input scanning session settings:\n");
        mprintf("\t--------------------------------------------------\n")
        str2table(rows, ["Channel", "Measurement type", "Range", "Resolution"], 3)
        mprintf("\t--------------------------------------------------\n")
        if scan_freq >= 1000
            mprintf("\tScan frequency:\t\t%.5f kHz\n", scan_freq/1000);
            mprintf("\tActual scan frequency:\t%.5f kHz\n", real_freq/1000);
        else
            mprintf("\tScan frequency:\t\t%.5f Hz\n", scan_freq);
            mprintf("\tActual scan frequency:\t%.5f Hz\n", real_freq);
        end
        if 1 /real_freq > 0.001 then
            mprintf("\tScan period: \t\t%.5f seconds\n", 1 / real_freq);
        end

        if 1 /real_freq <= 0.001 then
            mprintf("\tScan period: \t\t%.5f ms\n", 1 / real_freq * 1000);
        end

        if scan_time < 0
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\tInf\n");
            mprintf("\tDuration:\t\tInf\n");
        else
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\t%d\n", scan_time * scan_freq);
            if scan_time == 1
                mprintf("\tDuration:\t\t%.2f second\n", scan_time);
            else
                mprintf("\tDuration:\t\t%.2f seconds\n", scan_time);
            end
        end
        mprintf("\t--------------------------------------------------\n")
    end
endfunction

function  mdaqAIScanInit(arg1, arg2, arg3, arg4, arg5, arg6)
    link_id = -1;

    if argn(2) == 5 then
        channels = arg1;
        aiRange = arg2;
        aiMode = arg3;
        scan_freq = arg4;
        scan_time = arg5;
    end

    if argn(2) == 6 then
        link_id = arg1;
        channels = arg2;
        aiRange = arg3;
        aiMode = arg4;
        scan_freq = arg5;
        scan_time = arg6;

        if link_id < 0 then
            error("Invalid connection ID!")
            return;
        end
    end

    global %microdaq;
    if %microdaq.private.mdaq_hwid <> [] then
        adc_info = get_adc_info(%microdaq.private.mdaq_hwid);
        if argn(2) > 6 | argn(2) < 5 then
            mprintf("Description:\n");
            mprintf("\tInit AI scan\n");
            mprintf("Usage:\n");
            mprintf("\tmdaqAIScanInit(linkID, channels, range, isDifferential, rate, duration)\n");
			mprintf("\tlinkID - connection id returned by mdaqOpen() (OPTIONAL)\n");
            mprintf("\tchannels - analog input channels to read\n");
            mprintf("\trange - analog input range matrix e.g.\n");
            mprintf("\t        [-10,10] - single range argument applied for all used channels\n");
            mprintf("\t        [-10,10;-5,5] - multi-range argument for two channels\n");
			mprintf("\tisDifferential - scalar or vector with measurement mode settings: %%T - differential, %%F - single-ended mode\n");
            mprintf("\trate - scans per second rate (scan frequency)\n");
            mprintf("\tduration - scan duration in seconds\n");
            return;
        end
    else
        error('Unable to detect MicroDAQ configuration. Run mdaqHWInfo() function.');
    end

    ch_count = size(channels, 'c');

    if scan_time < 0 then
        scan_time = -1;
    end

    if size(channels, 'r') > 1 then
        error('Wrong channel - scalar or single row vector expected')
    end

    if size(aiRange, 'c') <> 2 then
        error('Wrong range - matrix range [low,high;low,high;...] expected')
    end

    aiRangeSize = size(aiRange, 'r');
    if aiRangeSize <> 1 & aiRangeSize <> ch_count then
        error('Range vector should match selected AI channels')
    end

    if type(aiMode) == 1 then
        if size(find(aiMode>1), '*') > 0
            error('Wrong mode - boolean value expected (%T/1, %F/0)')
        end
    end

    if size(aiMode, 'r') > 1 then
        error('Wrong mode - scalar or single row vector expected')
    end

    aiModeSize = size(aiMode, 'c');
    if aiModeSize <> 1 & aiModeSize <> ch_count then
        error('Mode vector should match selected AI channels')
    end

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

    aiRange_t = aiRange;
    aiRange = matrix(aiRange', 1, ch_count*2);

    aiMode(find(aiMode==%T))=1;
    if aiModeSize == 1 then
        aiMode = ones(1, ch_count) * aiMode;
    end

    if argn(2) == 5 then
        link_id = mdaqOpen();
        if link_id < 0 then
            error("Unable to connect to MicroDAQ device!");
        end
    end

    result = [];
    real_freq = scan_freq;
    [result real_freq] = call("sci_mlink_ai_scan_init",..
                    link_id, 1, "i",..
                    channels, 2, "i",..
                    ch_count, 3, "i",..
                    aiRange, 4, "d",..
                    aiMode, 5, "i",..
                    scan_freq, 6, "d",..
                    scan_time, 7, "d",..
                "out",..
                    [1, 1], 9, "i",..
                    [1, 1], 8, "d");

    if result < 0 & result <> -88 then
        if argn(2) == 5 then
            mdaqClose(link_id);
        end
        error(mdaq_error2(result), 10000 + abs(result));
    else
        if result == -88 then
            disp("Warninng: AI scanning interrupted!")
            mdaqAIScanStop()

            // time to terminate TCP connection
            sleep(200);
            [result real_freq] = call("sci_mlink_ai_scan_init",..
                            link_id, 1, "i",..
                            channels, 2, "i",..
                            ch_count, 3, "i",..
                            aiRange, 4, "d",..
                            aiMode, 5, "i",..
                            scan_freq, 6, "d",..
                            scan_time, 7, "d",..
                        "out",..
                            [1, 1], 9, "i",..
                            [1, 1], 8, "d");
        end

        if argn(2) == 5 then
            mdaqClose(link_id);
        end

        if result < 0 then
            error(mdaq_error2(result), 10000 + abs(result));
        end

        if result == 1 then
            limited_cap = %t;
        else
            limited_cap = %f;
        end

        rows = [];
        row = '';

        adc_res = strtod(part(adc_info.resolution, 1:2))
        for j=1:ch_count
            if aiMode(j) == 1 then
                measure_type = "Differential"
            elseif (aiMode(j) == 0)
                measure_type = "Single-ended"
            end
            adc_range = aiRange_t(j, 2) - aiRange_t(j, 1);
            resolution = string((int(adc_range/2^adc_res * 1000000)) / 1000);
            rangeStr="";
            if aiRange_t(j, 1) < 0 then
                rangeStr = "±" + string(aiRange_t(j, 2))+"V";
            else
                rangeStr = "0-" + string(aiRange_t(j, 2))+"V";
            end
            rows = [rows; "AI"+string(channels(j)), measure_type, rangeStr, resolution+"mV"]
        end

        mprintf("\nAnalog input scanning session settings:\n");
        mprintf("\t--------------------------------------------------\n")
        str2table(rows, ["Channel", "Measurement type", "Range", "Resolution"], 3)
        mprintf("\t--------------------------------------------------\n")
        if scan_freq >= 1000
            mprintf("\tScan frequency:\t\t%.5f kHz\n", scan_freq/1000);
            mprintf("\tActual scan frequency:\t%.5f kHz\n", real_freq/1000);
        else
            mprintf("\tScan frequency:\t\t%.5f Hz\n", scan_freq);
            mprintf("\tActual scan frequency:\t%.5f Hz\n", real_freq);
        end
        if 1 /real_freq > 0.001 then
            mprintf("\tScan period: \t\t%.5f seconds\n", 1 / real_freq);
        end

        if 1 /real_freq <= 0.001 then
            mprintf("\tScan period: \t\t%.5f ms\n", 1 / real_freq * 1000);
        end

        if scan_time < 0
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\tInf\n");
            mprintf("\tDuration:\t\tInf\n");
        else
            mprintf("\tNumber of channels:\t%d\n", ch_count)
            mprintf("\tNumber of scans:\t%d\n", scan_time * scan_freq);
            if scan_time == 1
                mprintf("\tDuration:\t\t%.2f second\n", scan_time);
            else
                mprintf("\tDuration:\t\t%.2f seconds\n", scan_time);
            end
        end
        mprintf("\t--------------------------------------------------\n")
    end
endfunction


Change ffmpeg command to match movie aspect ratio

clear();
clearglobal;

video_path = uigetfile("*.*","","Select Video data",%t);

drop = uigetdir();

for i = 1:size(video_path, 2)
    unix_s("mkdir -p " + drop + "/" + string(i) )
    unix_s("/usr/local/Cellar/ffmpeg/3.2/bin/ffmpeg -i " + video_path(i) + " -r 50 -s 853x479 -aspect 853:479 -qscale 1 " + drop + "/" + string(i) + "/image%04d.png") // + "/" + string(i)
end

clear();
clearglobal;

video_path = uigetfile("*.*","","Select Video data",%t);

drop = uigetdir();

for i = 1:size(video_path, 2)
    unix_s("mkdir -p " + drop + "/" + string(i) )
    unix_s("/usr/local/Cellar/ffmpeg/3.2/bin/ffmpeg -i " + video_path(i) + " -aspect 720:576 " + drop + "/" + string(i) + "/image%04d.png") // + "/" + string(i)
end


Attempt to stabilize setup gui

Attempt to stabilize setup gui

function [] = microdaq_setup()
    sci_ver_str = getversion('scilab', 'string_info');

    if sci_ver_str == 'scilab-5.5.2' then
     SETUP_PATH = mdaq_toolbox_path()+'macros'+filesep()+'microdaq_setup_template.sce';
        exec(SETUP_PATH,-1);
        while STATE
            if findobj('Tag','edit2') == [] then
                global STATE
                STATE = 0
                sleep(100)
            end
        end
    end
endfunction

function [] = microdaq_setup()
    sci_ver_str = getversion('scilab', 'string_info');

    if sci_ver_str == 'scilab-5.5.2' then
     SETUP_PATH = mdaq_toolbox_path()+'macros'+filesep()+'microdaq_setup_template.sce';
        exec(SETUP_PATH,-1);
        while STATE
            if findobj('Tag','edit2') == [] then
                global STATE
                STATE = 0
                sleep(500)
            end
            xpause(300);
        end
    end
endfunction


Fix signal block under scilab6.0

Fix signal block under scilab6.0

outputptr size was modified during assigment

function block=mdaq_signal_sim(block,flag)
    select flag
    case -5 // Error
    case 0 // Derivative State Update

    case 1 // Output Update
        global %microdaq;
        if %microdaq.dsp_loaded == %T then
                if %microdaq.private.signal_buffer_index(block.ipar(1)) < 1 then
                    try
                        %microdaq.private.signal_buffer(block.ipar(1)) = mdaqDSPRead(block.ipar(1), block.insz(1), %microdaq.private.signal_buffer_size(block.ipar(1)), 2);

                        %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_size(block.ipar(1));
                    catch
                        error("Unable to receive data from MicroDAQ device");
                    end

                end
                block.outptr(1) = %microdaq.private.signal_buffer(block.ipar(1))(%microdaq.private.signal_buffer_size(block.ipar(1)) + 1 - %microdaq.private.signal_buffer_index(block.ipar(1)),:)';
                %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_index(block.ipar(1)) - 1;
        else
            // Simply copy input to output
            block.outptr(1) = block.inptr(1);
        end
    case 2 // State Update
    case 3 // OutputEventTiming
    case 4 // Initialization
        global %microdaq;
        update_rate = 50;
        if %microdaq.private.model_tsamp < 1/update_rate then
            %microdaq.private.signal_buffer_size(block.ipar(1)) = (1/update_rate)/%microdaq.private.model_tsamp ;
        else
            %microdaq.private.signal_buffer_size(block.ipar(1)) = 1;
        end

        %microdaq.private.signal_buffer(block.ipar(1)) = zeros(%microdaq.private.signal_buffer_size(block.ipar(1)), block.insz(1));
        %microdaq.private.signal_buffer_index(block.ipar(1)) = 0;
    case 5 // Ending
    case 6 // Re-Initialisation
    case 9 // ZeroCrossing
    else // Unknown flag
    end
endfunction

function block=mdaq_signal_sim(block,flag)
    select flag
    case -5 // Error
    case 0 // Derivative State Update

    case 1 // Output Update
        global %microdaq;
        if %microdaq.dsp_loaded == %T then
                if %microdaq.private.signal_buffer_index(block.ipar(1)) < 1 then
                    try
                        %microdaq.private.signal_buffer(block.ipar(1)) = mdaqDSPRead(block.ipar(1), block.insz(1), %microdaq.private.signal_buffer_size(block.ipar(1)), 5000);

                        %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_size(block.ipar(1));
                    catch
                        warning("Unable to receive DSP data from MicroDAQ device");
                        return;
                    end

                end
                block.outptr(1) = %microdaq.private.signal_buffer(block.ipar(1))(%microdaq.private.signal_buffer_size(block.ipar(1)) + 1 - %microdaq.private.signal_buffer_index(block.ipar(1)),:);
                %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_index(block.ipar(1)) - 1;
        else
            // Simply copy input to output
            block.outptr(1) = block.inptr(1);
        end
    case 2 // State Update
    case 3 // OutputEventTiming
    case 4 // Initialization
        global %microdaq;
        update_rate = 50;
        if %microdaq.private.model_tsamp < 1/update_rate then
            %microdaq.private.signal_buffer_size(block.ipar(1)) = (1/update_rate)/%microdaq.private.model_tsamp ;
        else
            %microdaq.private.signal_buffer_size(block.ipar(1)) = 1;
        end

        %microdaq.private.signal_buffer(block.ipar(1)) = zeros(%microdaq.private.signal_buffer_size(block.ipar(1)), block.insz(1));
        %microdaq.private.signal_buffer_index(block.ipar(1)) = 0;
    case 5 // Ending
    case 6 // Re-Initialisation
    case 9 // ZeroCrossing
    else // Unknown flag
    end
endfunction


INTEGRATION: CWS unoapi1 (1.2.440); FILE MERGED 2007/10/15 15:04:34 cn 1.2.440.3: #i79479# update Lists 2007/10/15 09:27:54 cn 1.2.440.2: #i79479# update Lists 2007/08/24 15:17:25 cn 1.2.440.1: #i79479# updateLists

#-o toolkit.AccessibleButton
#-o toolkit.AccessibleCheckBox
#-o toolkit.AccessibleComboBox
#-o toolkit.AccessibleDropDownComboBox
-o toolkit.AccessibleDropDownListBox
#-o toolkit.AccessibleEdit
-o toolkit.AccessibleFixedText
-o toolkit.AccessibleList
#-o toolkit.AccessibleListBox
#-o toolkit.AccessibleListItem
#-o toolkit.AccessibleMenu
#-o toolkit.AccessibleMenuBar
#-o toolkit.AccessibleMenuItem
#-o toolkit.AccessibleMenuSeparator
#-o toolkit.AccessiblePopupMenu
#-o toolkit.AccessibleRadioButton
-o toolkit.AccessibleScrollBar
-o toolkit.AccessibleStatusBar
#-o toolkit.AccessibleStatusBarItem
#-o toolkit.AccessibleTabControl
-o toolkit.AccessibleTabPage
#-o toolkit.AccessibleToolBox
#-o toolkit.AccessibleToolBoxItem
-o toolkit.AccessibleWindow
-o toolkit.MutableTreeDataModel
-o toolkit.MutableTreeNode
-o toolkit.TabController
-o toolkit.TabControllerModel
#-o toolkit.Toolkit
#-o toolkit.UnoControlButton
-o toolkit.UnoControlButtonModel
#-o toolkit.UnoControlCheckBox
-o toolkit.UnoControlCheckBoxModel
#-o toolkit.UnoControlComboBox
#-o toolkit.UnoControlComboBoxModel
-o toolkit.UnoControlContainer
#-o toolkit.UnoControlContainerModel
#-o toolkit.UnoControlCurrencyField
#-o toolkit.UnoControlCurrencyFieldModel
#-o toolkit.UnoControlDateField
#-o toolkit.UnoControlDateFieldModel -> FREEZE in awt.XControlContainer
#-o toolkit.UnoControlDialog
-o toolkit.UnoControlDialogModel
# -o toolkit.UnoControlEdit
-o toolkit.UnoControlEditModel
#-o toolkit.UnoControlFileControl
-o toolkit.UnoControlFileControlModel
-o toolkit.UnoControlFixedLineModel
#-o toolkit.UnoControlFixedText
#-o toolkit.UnoControlFixedTextModel
#-o toolkit.UnoControlFormattedField
#-o toolkit.UnoControlFormattedFieldModel
#-o toolkit.UnoControlGroupBox
-o toolkit.UnoControlGroupBoxModel
#-o toolkit.UnoControlImageControl
-o toolkit.UnoControlImageControlModel
#-o toolkit.UnoControlListBox
-o toolkit.UnoControlListBoxModel
#-o toolkit.UnoControlNumericField
-o toolkit.UnoControlNumericFieldModel
#-o toolkit.UnoControlPatternField
-o toolkit.UnoControlPatternFieldModel
-o toolkit.UnoControlProgressBarModel
#-o toolkit.UnoControlRadioButton
-o toolkit.UnoControlRadioButtonModel
-o toolkit.UnoControlScrollBarModel
#-o toolkit.UnoControlTimeField
-o toolkit.UnoControlTimeFieldModel
#-o toolkit.UnoScrollBarControl
#-o toolkit.UnoSimpleAnimationControl
#-o toolkit.UnoSimpleAnimationControlModel
#-o toolkit.UnoSpinButtonControl
-o toolkit.UnoSpinButtonControlModel
#-o toolkit.UnoThrobberControl
#-o toolkit.UnoThrobberControlModel
-o toolkit.UnoTreeControl
-o toolkit.UnoTreeModel

-o toolkit.TabController
-o toolkit.TabControllerModel
-o toolkit.UnoControlButton
-o toolkit.UnoControlButtonModel
-o toolkit.UnoControlCheckBox
-o toolkit.UnoControlCheckBoxModel
-o toolkit.UnoControlComboBox
-o toolkit.UnoControlComboBoxModel
-o toolkit.UnoControlContainer
-o toolkit.UnoControlContainerModel
-o toolkit.UnoControlCurrencyField
-o toolkit.UnoControlCurrencyFieldModel
-o toolkit.UnoControlDateField
-o toolkit.UnoControlDateFieldModel
-o toolkit.UnoControlDialogModel
-o toolkit.UnoControlEdit
-o toolkit.UnoControlEditModel
-o toolkit.UnoControlFileControl
-o toolkit.UnoControlFileControlModel
-o toolkit.UnoControlFixedLineModel
-o toolkit.UnoControlFixedText
-o toolkit.UnoControlFixedTextModel
-o toolkit.UnoControlFormattedField
-o toolkit.UnoControlFormattedFieldModel
-o toolkit.UnoControlGroupBox
-o toolkit.UnoControlGroupBoxModel
-o toolkit.UnoControlImageControlModel
-o toolkit.UnoControlListBox
-o toolkit.UnoControlListBoxModel
-o toolkit.UnoControlNumericField
-o toolkit.UnoControlNumericFieldModel
-o toolkit.UnoControlPatternField
-o toolkit.UnoControlPatternFieldModel
-o toolkit.UnoControlProgressBarModel
-o toolkit.UnoControlRadioButton
-o toolkit.UnoControlRadioButtonModel
-o toolkit.UnoControlScrollBarModel
-o toolkit.UnoControlTimeField
-o toolkit.UnoControlTimeFieldModel
-o toolkit.UnoScrollBarControl
-o toolkit.UnoSpinButtonControlModel
-o toolkit.UnoSpinButtonControl
-o toolkit.AccessibleButton
-o toolkit.AccessibleCheckBox
-o toolkit.AccessibleComboBox
-o toolkit.AccessibleDropDownComboBox
-o toolkit.AccessibleDropDownListBox
-o toolkit.AccessibleEdit
-o toolkit.AccessibleFixedText
-o toolkit.AccessibleList
-o toolkit.AccessibleListBox
-o toolkit.AccessibleListItem
-o toolkit.AccessibleMenu
-o toolkit.AccessibleMenuBar
-o toolkit.AccessibleMenuItem
-o toolkit.AccessibleMenuSeparator
-o toolkit.AccessiblePopupMenu
-o toolkit.AccessibleRadioButton
-o toolkit.AccessibleScrollBar
-o toolkit.AccessibleStatusBar
-o toolkit.AccessibleStatusBarItem
-o toolkit.AccessibleTabControl
-o toolkit.AccessibleTabPage
-o toolkit.AccessibleToolBox
-o toolkit.AccessibleToolBoxItem
-o toolkit.AccessibleWindow
-o toolkit.UnoControlDialog
-o toolkit.Toolkit
-o toolkit.UnoControlImageControl