MATLAB: How to get rid of error using find too many input arguments

errortoomanyinputargumetns

[find(stock.permno)]==notrading(1);
for i=1:18522
end
for j=10137
newt(find(toremove(i)==c),:)=[];
end

Best Answer

In the command
[find(stock.permno)]==notrading(1);
if stock is a non-scalar structure, then it will undergo structure expansion; https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html#br2js35-6 becoming the equivalent of
[find(stock(1).permno, stock(2).permno, stock(3).permno ..., stock(end).permno)] == notrading(1);
The find command cannot have more than three arguments; https://www.mathworks.com/help/matlab/ref/find.html so if stock() is a structure array with more than three elements, the structure expansion would lead to more than three arguments in the find() call.
Possibly you want
find([stock.permno])==notrading(1);
This would be the equivalent of
find(horzcat(stock.permno))==notrading(1);
which would still be structure expansion but horzcat() allows any number of arguments and tries to put them together into rows. The [stock.permno] would create rows or 2D arrays, depending on the shape of the permno elements.
find() applied to that would give the indices of all of the non-zero values of that list.
The == operator applied to that list would compare all of those indices to the scalar value notrading(1) . A logical result, true or false, would result for each index.
Having computed the list of true and false values, you then throw all of them away without storing them or displaying them. So unless you are doing timing tests, you might as well not have computed this value.