error unrecognized function or variable help me please :(

조회 수: 4 (최근 30일)
Time
Time 2024년 2월 7일
답변: Cris LaPierre 2024년 2월 7일
function [] = PlotSignal(signalsCell,n)
signals=signalsCell{2*n-1};
plot(signals,'k')
end
Write a function called PlotSignal, the function will display on a graph the signal it receives.
function inputs:signalsCell – cell array object (each pair of rows in it represents one letter)
1.1.2 n – the number of the signal to be displayed
1.2. The function does not return any value.
1.3. The letter n from the array of cells should be displayed on a graph according to the following detail:
1.3.1. The signal color shall be black.
thats a part from the task i also got a load folder named "signals" to write this code .
but i always get a error about the signalcells
>> PlotSignal(signalsCell, n)
Unrecognized function or variable 'signalsCell'.
can anyone help me with that ? did i even wrote the code ok ? im not sure tho .

답변 (1개)

Cris LaPierre
Cris LaPierre 2024년 2월 7일
You need to define your function inputs. You have no variable in your workspace names signalsCell. Define one before calling your function. Here's a simple example
x = 2*pi;
% works because x has been defined
sin(x)
ans = -2.4493e-16
% error because y has not been defined
sin(y)
Unrecognized function or variable 'y'.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by