Matlab Coder 2.0/Inputing Data Types
1 次查看(过去 30 天)
显示 更早的评论
Good Morning,
I am attempting to use Matlab Coder 2.0 for the 2011a version. I can't seem to find a really detailed tutorial or a step by step example so if anyone could point me in the right direction towards one it would be greatly appreciated.
I have a program which contains three scripts:
There are three functions: create, check and interp which need primary input data types and I cannot figure out how to define each type before running it in Matlab coder. Here are the info for input in matlab:
function options = create(x, y, varargin)
%CREATE Creates a Function for Interpolation of scattered
%data points of n dimensions.
% P = SET(X, Y, 'NAME1',VALUE1,'NAME2',VALUE2,...) where the
%Input Parameters are:
% x: [ dim by n matrix of coordinates for the nodes ]
% y: [ 1 by n vector of values at nodes ]
% Function: [ gaussian | thinplate | cubic | multiquadrics | {linear} ]
% Constant: [ positive scalar ]
% Approx: [ positive scalar {0} ]
% Stats: [ on | {off} ]
%
%Output:
% options: a curve or surface equation (or set) defined by the input parameters
function maxdiff = check(options)
%CHECK gives the error estimates of the original data and the values generated by the function CREATE.m
%Input Parameters:
% options: the function (or set) procduced by CREATE
%Output:
% maxdiff: the maximum distance between original data and CREATE
function [f] = interp(x, options)
%INTERP interpolates the curve or surface produced by CREATE.
% Input Parameters:
% x: [ dim by n matrix of coordinates for the desired values ]
% options: the function (or set) procduced by CREATE
% Output:
% f: desired values specified by input
If anyone could help me on how to define each one to use in matlab coder it would be greatly appreciated.
Thanks,
Mel
0 个评论
回答(1 个)
Friedrich
2011-12-5
Hi,
when using a MATLAB Coder project you can specify the input data types:
Or when using the codegen command look at the -args option:
2 个评论
Kaustubha Govind
2011-12-7
Melissa: You cannot use varargin at top-level functions when generating code (see http://www.mathworks.com/help/toolbox/eml/ug/brlb0rj.html) - so just specify the number of arguments (using -args) that the function should take in its generated code form. For the n-dimensional matrix - do you mean that 'n' is variable? If yes, I don't know that you change the number of dimensions (although you can change the number of elements in each dimension - look up coder.varsize for this in the documentation)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!