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

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

댓글을 달려면 로그인하십시오.

 채택된 답변

Stephen23
Stephen23 2018년 6월 10일
NDVIs = (subplots(299,:)-subplots(195,:))./(subplots(299,:)+subplots(195,:));

댓글 수: 1

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품

릴리스

R2017b

태그

질문:

2018년 6월 10일

댓글:

2018년 6월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by