What does Undefined operator '-' for input arguments of type 'string' mean?

Hi, I am a beginner user of Matlab. I keep getting " Undefined operator '-' for input arguments of type 'string'", and I have no idea how I need to fix my script. Appreciate any help resolving this issue.
Below is my script:
%NDVI = (infrared - red)./(infrared + red);
NDVIs= ("subplots(299,:)"-"subplots(195,;)")./("subplots(299,:)"+"subplots(195,:)");
Error message:
Undefined operator '-' for input arguments of type 'string'.
Error in Exercise_NDVI (line 2)
NDVIs= ("subplots(299,:)"-"subplots(195,;)")./("subplots(299,:)"+"subplots(195,:)");

1 comentario

What do you think that the line
NDVIs= ("subplots(299,:)"-"subplots(195,;)")./("subplots(299,:)"+"subplots(195,:)");
is supposed to do???

Iniciar sesión para comentar.

 Respuesta aceptada

NDVIs = (subplots(299,:)-subplots(195,:))./(subplots(299,:)+subplots(195,:));

1 comentario

Thanks, Stephen. I use the exact script that you shared, and it worked (no more error!)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2017b

Etiquetas

Preguntada:

el 10 de Jun. de 2018

Comentada:

el 10 de Jun. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by