Clear Filters
Clear Filters

error unrecognized function or variable help me please :(

5 views (last 30 days)
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 .

Answers (1)

Cris LaPierre
Cris LaPierre on 7 Feb 2024
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'.

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!