How to use a vector as input for a function?

1 Ansicht (letzte 30 Tage)
Jeroen
Jeroen am 16 Mai 2014
Bearbeitet: Randy Souza am 19 Mai 2014
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?

Antworten (1)

Henric Rydén
Henric Rydén am 16 Mai 2014
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 Kommentare
Jeroen
Jeroen am 16 Mai 2014
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.
Henric Rydén
Henric Rydén am 19 Mai 2014
OK, could you post the code in calc_file.m?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by