0
votes

i have the code below :

if encoded(i)==code1(2,j)

that is a simple line and basically i want to save a specific element from a cell array named code1 into another array named encoded. The problem here is that matlab shows the below message:

Undefined operator == for input arguments of type cell. Is there any solution to this problem? How can i save an element from a cell array into a normal array in MATLAB?

1
Use curly braces: code1{2,j} - beaker

1 Answers

0
votes

Use the function cellfun. Depending on the type of data in code1{2,j}, the first argument of the cellfun should be an appropriate function.

For example, if code1{2,j} is a string, use

cellfun(@str2double, code1{2,j})

Alternatively, if code1{2,j} is an array, use cell2mat as

cell2mat(code1{2,j})