这是我的代码
%This function takes an array of 128Bvalue numbers and returns the equivalent binary
%values in a string phrase
function [PhrasePattern] = GetPatternForValuesFinal(BarcodeNumberValues)
load code128B.mat;
Pattern = {};
%The correspomnding binary sequence for each barcode value is
%identified and fills the cell array
for roll = 1:length(BarcodeNumberValues);
BarcodeRow = str2double(BarcodeNumberValues{1,roll}) + 1;
Pattern{1,roll} = code128B{BarcodeRow,3};
end
%The individual patterns are then converted into a single string
PhrasePattern = strcat(Pattern{1,1:length(Pattern)});
end
该函数的目的是使用一个数字数组,并将它们转换为相应二进制字符串值的元胞数组,然后连接这些字符串。错误来自第 11 行第 26 列,
Pattern{1,roll} = code128B{BarcodeRow,3}; subscript indices must be either positive integers or logicals
这是否意味着我无法创建字符串元胞数组..?