Undefined operator '*' for input arguments of type 'cell'

I am getting this error-"Undefined operator '*' for input arguments of type 'cell'".
for i=1:length(matrix.rxnIDs)
if strcmp(matrix.mettype(i),'reactant')
matrix.metcoef(i) = matrix.metcoef(i).*-1;
end
end

 Akzeptierte Antwort

Stephen23
Stephen23 am 28 Jan. 2019
Bearbeitet: Stephen23 am 28 Jan. 2019

0 Stimmen

matrix.metcoef{i} = matrix.metcoef{i} .* -1
matrix.metcoef{i} = -matrix.metcoef{i}; % SIMPLER
% ^ ^ ^ ^ Use the correct brackets
Read about the different ways to access cell arrays:
Remember:
  • () parentheses access the cells themselves.
  • {} curly braces access the cell contents.

Weitere Antworten (0)

Kategorien

Gefragt:

am 28 Jan. 2019

Kommentiert:

am 28 Jan. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by