0

我想按时间输出这个 3xN 矩阵(3 个坐标,随时间变化),一次一列。

我尝试过这种方式,但结果发现block.oz当标志为 1 时不会更新,即使我在标志为 2 时更改了它。这是我的接口函数的简化版本:

// Interface function
function [x,y,typ]=FOO(job,arg1,arg2)
    x=[];y=[];typ=[];
    select job
    case 'plot' then
        standard_draw(arg1);
    case 'getinputs' then
        [x,y,typ]=standard_inputs(arg1);
    case 'getoutputs' then
        [x,y,typ]=standard_outputs(arg1);
    case 'getorigin' then
        [x,y]=standard_origin(arg1);
    case 'set' then
        x=arg1;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        model=arg1.model;

        description = ["Set FOO parameters"];
        labels = ["para1"];
        types = list("col", 1);
        [ok, para1, exprs]=getvalue(description,labels, types, exprs);

        model.rpar  = [para1];
        graphics.exprs=exprs;
        x.graphics=graphics;
        x.model=model;

    case 'define' then
        para1 = 1;
        model   = scicos_model();
        model.sim   = list('foo',5);
        model.in    = [1];
        model.in2   = [1];
        model.intyp = [1];
        model.out   = [3];
        model.out2  = [1];
        model.outtyp= [1];
        model.rpar  = [para1];     
        model.evtin = 1;
        model.odstate = list([0]);
        model.blocktype='c';
        model.dep_ut=[%t %f];
        exprs=[string(para1)];      

        x=standard_define([2 4],model,exprs);
    end
endfunction

还有我的计算功能:

// Computation function
function block=foo(block,flag)
    select flag
    case 1 then
        bar = foobar(block.inptr(1), block.rpar(1)); // bar is a 3xN matrix
        n = block.oz(1);
        block.outptr(1) = bar(1:3,n);
        
    case 2 then
        block.oz(1) = block.oz(1) + 1;
    case 4 then
        block.oz(1) = 1;
    case 5 then
        ;
    case 6 then
        ;
    else
        error(msprintf(gettext("%s : Incorect flag %d"), block_name, flag));
    end
endfunction
4

0 回答 0