Not enough input Arguments Error & error in Height

6 visualizaciones (últimos 30 días)
Daniel Louw
Daniel Louw el 9 de Abr. de 2022
Respondida: KSSV el 9 de Abr. de 2022
Greetings,
I am quite new to MatLab. I keep getting the "not enough input arguments" error for this code. When I try to look up errors for this, I usually find the problem with people's code is in defining their functions, but I am not using any functions in this code.
I get the error "not enough input arguments" as well as "error in height", which I don't understand because I am not defining a height? I assume it is refering to the column in the excel file but column 11 is complete and the same length as the other columns and I've had no errors with them.
Any help would be appreciated.
Daniel
clc; clear; close all
table = readtable('wood_1');
original_L = 21.5;
time = table{:,1};
load = table{:,2};
position = table{:,3};
stress = table{:,11};
strain = position/original_L;
thickness = 1.01;
length = 21.5;
width = 1.48;
loadspacing = 5.386666667;
testload = load(5103);
MoR = ((testload/2)*(loadspacing/2) * (thickness/2) / (((width*height)/12)));
Error message:
Not enough input arguments.
Error in height (line 10)
H = size(X,1);
Error in Lab9 (line 44)
MoR = ((testload/2)*(loadspacing/2) * (thickness/2) / (((width*height)/12)));

Respuestas (1)

KSSV
KSSV el 9 de Abr. de 2022
Note that height is a inbuilt function. You have not defined the variable height which is defined in the line:
MoR = ((testload/2)*(loadspacing/2) * (thickness/2) / (((width*height)/12)));
As the variable is not defined, it is expecting to use a inbuilt function, for this function input should be a table and as there is no input it is throwing error.
What to do:
  1. Dont name variables on the function names.
  2. DEfine the variable height value and assign it to different variable.

Categorías

Más información sobre Scope Variables and Generate Names en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by