MATLAB Answers

Error "Undefined function 'min' for input arguments of type 'cell'. Error in wblplot (line 27) minx = min(sx(:));"

7 ビュー (過去 30 日間)
alsa
alsa 2018 年 2 月 19 日
回答済み: Achyutha Hosahalli 2018 年 2 月 22 日
I am making a GUI using App Designer to plot a weibull distribution plot and I used the "Text Area" that "allows multiline text entry", but I run the GUI and input (ie. breakdown time) the numbers in, the error "Undefined function 'min' for input arguments of type 'cell'. Error in wblplot (line 27) minx = min(sx(:));" showed up.
This is the function on which the error happens:
T1=(app.BreakdownTime1.Value);
T2=(app.BreakdownTime2.Value);
T3=(app.BreakdownTime3.Value);
T4=(app.BreakdownTime4.Value);
T5=(app.BreakdownTime5.Value);
T=[T1 T2 T3 T4 T5];
plot(app.wbldist,wblplot(T));
What does the error text mean and what should I do?

採用された回答

Achyutha Hosahalli
Achyutha Hosahalli 2018 年 2 月 22 日
Hi Tsalsabilla !
Since you are using Text Area, its values would return the value which is of type cell array. But min function requires the data to be of type double. The easiest way would be to use Edit Field(numeric) to get the values and do the remaining stuff as you are doing. Edit Field(numeric) returns the value as type double. If you still want to use the Text Area and get it working, you can convert the data types of the values before you use it to plot.
For ex:
T1=str2double(char(app.BreakdownTime1.Value));
T2=str2double(char(app.BreakdownTime2.Value));
T3=str2double(char(app.BreakdownTime3.Value));
T4=str2double(char(app.BreakdownTime4.Value));
T5=str2double(char(app.BreakdownTime5.Value));
T=[T1 T2 T3 T4 T5];
plot(app.wbldist,wblplot(T));

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by