×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

m-file (level 2) s-function - dynamic frame data setting

m-file (level 2) s-function - dynamic frame data setting

m-file (level 2) s-function - dynamic frame data setting

(OP)
I am now having problems when running my simulation with an m-file s-function that i have created. I recieve the following block error when i simulate:


Source 'registration/M-file (level-2)  S-Function' cannot have dynamic frame data setting for its output port 1. All sources should explicitly set all their output ports to be frame or non-frame

Here's my code (its pretty simple so i guess I'm missing somethimg):

function loadVTKpoints(block)
% Level-2 M file S-function for loading movie
% (image edge detection demonstration).
%   Copyright 1990-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $  
  
  setup(block);

function setup(block)
  
  %% Register parameters
  block.NumDialogPrms = 1;
  block.DialogPrmsTunable = {'Tunable'};

  %% Register number of ports
  block.NumInputPorts  = 0;
  block.NumOutputPorts = 2;
  
  %% Setup functional port properties
  block.SetPreCompOutPortInfoToDynamic;

  block.OutputPort(1).DatatypeID   = 0; % double
  block.OutputPort(1).Complexity   = 'Real';
  %block.OutputPort(1).SamplingMode = 'Sample';
  
  block.OutputPort(2).DatatypeID   = 5; % uint32???
  block.OutputPort(2).Complexity   = 'Real';
  %block.OutputPort(2).SamplingMode = 'Sample';

  %ALSO HGOW WOULD I SET THE DIMENSIONS OF THE ARRAY IF IT IS RETRIEVED
  %WITHIN MY FUNCTION
  %block.OutputPort(1).Dimensions = size(points);
  block.OutputPort(1).Dimensions = -1;
  block.OutputPort(2).Dimensions = 1;
  
  %% Register methods
  %%IVE TRIED BOTH OUTPUT AND OUTPUTNONFRAME
  block.RegBlockMethod('Outputs', @OutputNonFrame);
  %block.RegBlockMethod('Outputs',                 @Output);
  
%endfunction
  
function OutputNonFrame(block)
    CT_input_directory  = block.DialogPrm(1).Data;
    vtk_file        =   textread(CT_input_directory,'%s','delimiter','=" ','whitespace','');
    points_num      =   str2double(vtk_file(12));                                                       %Number of points
    points_end      =   14-1+3*points_num;

    index=0;
    index   = (14:points_end);
    points  =  str2double(vtk_file(index));

    clear vtk_file;
    
    block.OutputPort(1).Data = points;
    block.OutputPort(2).Data = cast(size(points),'int32');
  
%endfunction

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources