Effacer les filtres
Effacer les filtres

Matlab Coder 2.0/Inputing Data Types

1 vue (au cours des 30 derniers jours)
Melissa
Melissa le 4 Déc 2011
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

Réponses (1)

Friedrich
Friedrich le 5 Déc 2011
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 commentaires
Melissa
Melissa le 5 Déc 2011
I read the above documentation but I don't know how to apply it to the n dimensional matrix and the varargin options. Thank you for responding though!
Kaustubha Govind
Kaustubha Govind le 7 Déc 2011
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)

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by