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

6 views (last 30 days)
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);
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

Accepted Answer

Raghunandan V
Raghunandan V on 14 Mar 2019
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by