|
Hi Tiger,
I thought of another thing that could be causing confusion. When you swap out a block, it doesn't change the name. This confused me at first. In other words, if you have a FIFO Queue block and switch it with a Priority Queue block, the block will still be named "FIFO Queue". If you double click on the block, though, you can see that the name is just a name, and the dialog is for the Priority Queue. This is because when you replace a block, it's not clear you actually want to change the name. You might have renamed the block to be something special. You will need to explicitly change the name with a set_param if you want to change the name, as well as change the block.
-Teresa
"Teresa Hubscher-Younger" <teresa.hubscher-younger@mathworks.com> wrote in message <kip7m9$kcc$1@newscl01ah.mathworks.com>...
> Hi Tiger,
>
> This is mysterious. You do need a pathname, which you can get by clicking on a block and typing in gcb. But if I read your message right, you've done that.
>
> These were the steps specified by a developer to try out things to make sure they are working correctly.
>
> >> open_system sedemo_mm1 % as a test model
> >> open_system simeventslib % open simevents library
> >> replace_block('sedemo_mm1', 'Name', 'FIFO Queue', 'simeventslib/Queues/Priority Queue')
>
> If you know the block types, then the syntax is simpler:
>
> >> replace_block('sedemo_mm1', 'FIFOQueue', 'PriorityQueue')
>
> To find out the block type of a block you can do:
>
> >> get_param(gcb, 'BlockType')
>
> If you are continuing to have trouble with this, then please email me back and write a Support Request. (If you are using 12b, there is a pull-down choice to do this from MATLAB.) We need to get to the bottom of what is going on with this.
>
> Thanks,
> Teresa
>
> "Tiger" wrote in message <kias2m$36u$1@newscl01ah.mathworks.com>...
> > Thanks Phil.
> >
> > When I enter a SimEvents block in the 'new_blk' argument of 'replace_block' I get the following error:
> > ??? Error using ==> replace_block at 107
> > Invalid NewBlock (...) passed to REPLACE_BLOCK
> > Try built-in/<BLOCKTYPE> or a valid block name.
> >
> > However, it works well with SimEvents blocks in the 'old_blk' argumet, not sure what's the explaination for that? For instance, the following worked well:
> > >> replace_block('sys', 'FIFO Queue', 'Constant', 'noprompt')
> > The following doesn't work:
> > >> replace_block('sys', 'Constant', 'FIFO Queue', 'noprompt')
> >
> > What I want to do is replace a FIFO Queue with a Priority Queue, then use, as you suggested earlier, 'set_param' to modify the AttributeName for the priority used. That's all.
> >
> > I've tried using 'built-in/' as the error message suggests, but no results. I've tried putting the pathname, nothing. I even tried putting the path name of the SimEvents toolbox in my Matlab directory (C:ProgramFiles..), and no results.
> >
> > Why SimEvents blocks work well as 'old_blks' but not 'new_blks'?
|