Azzera filtri
Azzera filtri

'Value' must be a double scalar within the range of 'Limits'. HOW CAN WILL I SOLVE ?

3 visualizzazioni (ultimi 30 giorni)
slump=app.SlumpmmEditField.Value;
maxaggsize=app.MaximumAggregatesizemmEditField.Value;
WAC=[9.5 12.5 19 25 37.5 50 75 150;207 199 190 179 166 154 130 113;
228 216 205 193 181 169 145 124;243 228 216 202 190 178 160 150;
3 2.5 2 1.5 1 0.5 0.3 0.2];
if(slump<50)
i=2;
elseif(slump>=50&& slump<100)
i=3;
elseif(slump>=100)
i=4;
end
if(maxaggsize<=12.5)
j=1;
elseif(maxaggsize>12.5 && maxaggsize<=19)
j=2;
elseif(maxaggsize>19 && maxaggsize<=25)
j=3;
elseif(maxaggsize>25 && maxaggsize<=37.5)
j=4;
elseif(maxaggsize>37.5 && maxaggsize<=50)
j=5;
elseif(maxaggsize>50 && maxaggsize<=75)
j=6;
elseif(maxaggsize>75)
j=7;
end
Wwt1=WAC (i,j);
app.WaterkgEditField.Value = Wwt1;
%Wwt2=num2str(Wwt1);
Vair1=WAC(5,j);%Vair2=num2str(Vair1);
% Specified strength (MPa) at 28 days and find w/c ratio:
spstr=app.SpecifiedstrengthMPaat28daysEditField.Value;
if(spstr<21)
reqavgstr=spstr+7;
elseif(spstr>=21 && spstr<=35)
reqavgstr=spstr+8.5;
elseif(spstr>35)
reqavgstr=1.1*spstr+5;
end
cs=[70 65 60 55 50 45 40 35 30 25 20 15];
WCR=[.23 .25 .28 .31 .34 .38 .42 .47 .54 .61 .69 .79];
FWCR=interp1(cs,WCR,reqavgstr,'linear');
%FWCR2=num2str(FWCR);
% Estimation of cement:
Wcm=(Wwt1/FWCR);
% Wcm2=num2str(Wcm);
% Wcm3=sprintf('% kg/m3',Wcm);
% set(handles.cem,'string',Wcm3);
app.CementkgEditField.Value = Wcm;
% Estimation of CA:
fa_fm=app.FAkgEditField.Value;
ca_unwt=app.UnitWeightKgm3EditField.Value;
FA_FMB=[2.4 2.6 2.8 3];
VCA=[.5 .48 .46 .44;
.59 .57 .55 .53;
.66 .64 .62 .6;
.71 .69 .67 .65;
.75 .73 .71 .69;
.78 .76 .74 .72;
.82 .8 .78 .76;
.87 .85 .83 .81];
if(maxaggsize<=9.5)
i=1;
elseif(maxaggsize>9.5 && maxaggsize<=12.5)
i=2;
elseif(maxaggsize>12.5 && maxaggsize<=19)
i=3;
elseif(maxaggsize>19 && maxaggsize<=25)
i=4;
elseif(maxaggsize>25 && maxaggsize<=37.5)
i=5;
elseif(maxaggsize>37.5 && maxaggsize<=50)
i=6;
elseif(maxaggsize>50 && maxaggsize<=75)
i=7;
elseif(maxaggsize>75)
i=8;
end
VCA1=VCA(i,:);
FVCA=interp1(FA_FMB,VCA1,fa_fm,'linear');
wca=FVCA*ca_unwt;
app.CAkgEditField.Value = wca;
during the determination of wca,show this notification('Value' must be a double scalar within the range of 'Limits'.)how can will i solve this problem?

Risposte (1)

Vandit
Vandit il 30 Ago 2023
Hi,
The error message indicates that there is an issue with the input value for one of the variables. The 'EditField' objects in your code are likely set to accept specific ranges of values, and the error is triggered when the entered value falls outside those limits. To address this issue, you can use the 'discretize()' function in MATLAB to map the input value to a specific range that is within the limits of the 'EditField' objects.
Here's the code snippet for using the 'discretize()' function to discretize the input values:
% Determine the range limits for the SlumpmmEditField and MaximumAggregatesizemmEditField
slumpLimits = [0, 50, 100, inf]; % Define the limits for the slump variable
aggSizeLimits = [0, 12.5, 19, 25, 37.5, 50, 75, inf]; % Define the limits for the maxaggsize variable
% Discretize the input values using the defined limits
slumpRange = discretize(app.SlumpmmEditField.Value, slumpLimits, 'IncludedEdge', 'right');
aggSizeRange = discretize(app.MaximumAggregatesizemmEditField.Value, aggSizeLimits, 'IncludedEdge', 'right');
%Update the variables slump and maxaggsize based on the discretized ranges
%REST OF YOUR CODE.......
To know more about 'discretize()' function, refer to the link below :
Hope this helps.
Thankyou

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by