How to use a vector as input for a function?

2 次查看(过去 30 天)
I have the following m file:
function [Data] = calc_file(u)
where I would like to enter u as a vector. When I try to do this I get the following error:
>> calc_file(u)
??? Undefined function or method 'calc_file' for input
arguments of type 'double'.
How do I enter a vector as the input for a function?

回答(1 个)

Henric Rydén
Henric Rydén 2014-5-16
From your question, you seem to get this error only when u is a vector and not when it is a scalar?
It looks like the calc_file.m is not on your path.
  2 个评论
Jeroen
Jeroen 2014-5-16
I only get this error when i use a vector, with scalars it runs fine. And yes the calc_file.m is in my path.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Language Fundamentals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by