Borrar filtros
Borrar filtros

Index exceeds number of array elements

1 visualización (últimos 30 días)
Grace
Grace el 9 de Mzo. de 2024
Comentada: Torsten el 9 de Mzo. de 2024
expression1a = 3*cos(pi) - 2*log(3) + exp(4);
fprintf('The answer to 1A is: %.6f\n', expression1a);
I'm getting an "index exceesds number of array elements" error when I try to run this, even though it was working 5 minutes ago. What can I do to fix this?

Respuestas (1)

Walter Roberson
Walter Roberson el 9 de Mzo. de 2024
You accidentally created a variable named log or named exp
  3 comentarios
Grace
Grace el 9 de Mzo. de 2024
expression1 = 3*cos(pi) - 2*log(3) + exp(4);
fprintf('The answer to 1A is: %.6f\n', expression1);
The answer to 1A is: 49.400925
%1B
lvalue = log(150)/log(7);
expression1b = (atan(2) + lvalue - nthroot(88, 4))/(abs((sin(4)) - 1.4^1.4));
fprintf('The answer to 1B is: %.6f\n', expression1b);
The answer to 1B is: 0.262579
Does it have something to do with the next few lines?
Torsten
Torsten el 9 de Mzo. de 2024
I'd leave MATLAB and try a new session.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by