I have a ‘data’ file, ‘lab1.m’ in my working directory.
Here the content of them.
data:
0 1 2 3 4
2 0 9 2 7
5 6 3 4 7
lab1.m:
load data
function y = RSSI_to_dBm(x, z)
y = data(z, x);
end
However, there’s an error when I call RSSI_to_dBm(2, 2):
octave:30> RSSI_to_dBm(2, 4)
error: `data’ undefined near line 3 column 6
error: called from:
error: RSSI_to_dBm at line 3, column 4
How can I solve it?
And how can I load ‘data’ to a variable name such as ‘A’?
Thank you for answering.
I have tried out a solution:
It works by passing the “data” to the function every time I call it.