Some of the lines in the code below does not execute, why?

조회 수: 6 (최근 30일)
Lala0099
Lala0099 2019년 3월 13일
답변: Raghunandan V 2019년 3월 14일
Hi everyone,
The code example I included in the link was created to help my previous question in Mathwork , by Image Analyst.
There is a few lines in the code that does not execute.
[maxDeviation, timePoint3] = max(meanDeviationFromMean);
and as a result of this, some other lines dont execute either.
I tried to fin the problem. When I called certain values from the function: signal, meanSignal, sdSignal
by the line:
meanSignal = FindTimePoint2(xa);
sdSignal = FindTimePoint2(xa);
signal=FindTimePoint2(xa);
I got the same values for all of them,104,which makes me believe that there is something wrong with the input to the function?
I really dont understand why the signal ( which is the input to the function) comes out as a number. I thought it would be a coloumn ( and array of the content of one coloumn of a table).
I believe that is where the problem might originate, but i cannot seem to fix it. I am very unsure about the nature of the problem too...
I am a beginner. I would appreciate any help

채택된 답변

Raghunandan V
Raghunandan V 2019년 3월 14일
Hi,
I went through the code. Technically code has no problems with the code. Everyline is being executed. You can try it by having breakpoints. (As you are a beginner, you need to learn about break points. Its a great tool to debug any code). As far as the output 104 is considered, please look at the function FindTimePoint2. The returned value is
timePoint2 = find(meanDeviationFromMean(1:timePoint3) <= 6*sdSignal, 1, 'last');
This output is a single element for this particular data. hence you get single valur output from this function.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by