Loaded variable can't be indexed, unrecognized function or variable error

I am attempting to pull a specific index from data loaded into a file. Here's the code in question:
load 'aes_power_data.mat';
n_traces = 200;
traces = traces (1:n_traces, :);
plaintext = plain_text (1:n_traces, :);
...
function [result] = predict_Sbox(key, p_Text, byte)
PT = plaintext(p_Text, byte);
pos = bitxor(key,PT);
result = sbox(pos);
end
Load places a 200x16 double into the workspace, but the line "PT = plaintext(p_Text, byte);" is when the error occurs. So the first time I call this, it should pull the first value from plaintext (1,16). What am I doing incorrectly? Is the error in catching the variable or in my use of function or something else?

 采纳的回答

You do not have a nested function with shared variables, and you do not pass plaintext to the function.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

版本

R2019b

标签

Community Treasure Hunt

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

Start Hunting!

Translated by