Undefined operator '/' for input arguments of type 'cell'.
Ältere Kommentare anzeigen
Please help me I am a beginner. This code gives me error kindly spot the issue
syms Area length cost
prompt = {'Please Enter Value of Area in feet:'};
dlgtitle = 'Input Area';
dims = [1 45];
%k= input(prompt)
answer = inputdlg(prompt,dlgtitle,dims);
k = answer;
Area = k;
width = 20;
width = num2cell(width);
length = Area./width;
cost = 49.75.*length+ 30.*width;
Akzeptierte Antwort
Weitere Antworten (1)
VBBV
am 13 Dez. 2020
%rue
width = 20;
% width = num2cell(width);
Comment the num2cell line and try again
9 Kommentare
Salman Ahmed
am 13 Dez. 2020
VBBV
am 13 Dez. 2020
Use str2num to convert the input valued to numeric before performing the ./ operation
%true
width = 20;
width = num2cell(width)
length =str2num(Area)./str2num(width)
cost = 49.75.*length+30.*str2num(width)
Salman Ahmed
am 13 Dez. 2020
VBBV
am 14 Dez. 2020
What were your input values for Area ?
Did it contained any characters?
%rue
width = str2num(width);
cost = 49.75.*length+30.*(width)
VBBV
am 14 Dez. 2020
%true
width = 20;
width = num2cell(width)
Tlength =str2num(Area)./str2num(width)
cost = 49.75.*Tlength+30.*str2num(width)
Sorry, you have used builtin function length as variable to store values. Please change it to as above or something other than standard functions of matlab.
Salman Ahmed
am 14 Dez. 2020
Kategorien
Mehr zu Whos finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!