フィルターのクリア

I keep getting this error whilst predicting RUL

3 ビュー (過去 30 日間)
zuheir Jaffrali
zuheir Jaffrali 2022 年 10 月 3 日
回答済み: Rishi 2023 年 9 月 29 日
Hi so i am running matlabs RUL prediction code i keep on ketting this error what should i do i am so lost i want to do this RUL estimation from my undergraduate project heres the error.
'Unable to perform assignment because value of type 'duration' is not convertible to 'double'.
Caused by:
Error using duration/double (line 1075)
Undefined function 'double' for input arguments of type 'duration'. To convert from durations to numeric, use the SECONDS, MINUTES, HOURS, DAYS, or YEARS functions.'
this is the part of the code thats giving the error
numValidation = length(validationDataFused);
numBreakpoint = length(breakpoint);
error = zeros(numValidation, numBreakpoint);
for dataIdx = 1:numValidation
tmpData = validationDataFused{dataIdx};
for bpidx = 1:numBreakpoint
tmpDataTest = tmpData(1:ceil(end*breakpoint(bpidx)), :);
trueRUL = length(tmpData) - length(tmpDataTest);
[estRUL, ~, ~] = predictRUL(mdl, tmpDataTest);
error(dataIdx, bpidx) = estRUL - trueRUL;
end
end
  2 件のコメント
Siddharth Bhutiya
Siddharth Bhutiya 2022 年 10 月 3 日
The error message indicates that you are assigning a duration value to a double array somewhere in your code. If the error is coming from the code snippet you pasted above then it must be the following line.
error(dataIdx, bpidx) = estRUL - trueRUL;
here it seems that error might be a double array and the answer of (estRUL - trueRUL) is a duration?
zuheir Jaffrali
zuheir Jaffrali 2022 年 10 月 4 日
so in my code snippet estRUL is a duration and trueRUL isnt how do i change that i have tried everything if you can help please thanks

サインインしてコメントする。

回答 (1 件)

Rishi
Rishi 2023 年 9 月 29 日
Hi Zuheir,
I understand you want to know why you are getting this error. The following line is giving this error:
error(dataIdx, bpidx) = estRUL - trueRUL;
This is because you are trying to assign ‘estRUL – trueRUL’, which is of type duration to ‘error’, an array of type double. To fix this, you can convert ‘estRUL -trueRUL’ to numeric type first, using ‘seconds()’, ‘minutes()’, ‘hours()’, based on how you want the conversion.
For example,
d = duration(1, 2, 3)
d = duration
01:02:03
s = seconds(d)
s = 3723
h = hours(d)
h = 1.0342
You can refer to the following documentation for further information:
Regards,
Rishi Shrimal

カテゴリ

Help Center および File ExchangeDeploy Predictive Maintenance Algorithms についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by