Please help me fix this "Error: Function definitions are not permitted in this context. "
Show older comments
I keep getting the message "Error: Function definitions are not permitted in this context" whenever I try to declare a function.
The code I used was:
function T = truth_table(N) L = 2^N; T = zeros(L,N); for i=1:N temp = [zeros(L/2^i,1); ones(L/2^i,1)]; T(:,i) = repmat(temp,2^(i-1),1); end
(then this message appears)
??? function T = truth_table(N)
|
Error: Function definitions are not permitted in this context.
I tried copying a simple code from a tutorial that is quite similar to what I used.
function Answer = tenTimes(x)
Answer = 10 * x;
But still, this message appears:
??? function Answer = tenTimes(x) | Error: Function definitions are not permitted in this context.
Accepted Answer
More Answers (0)
Categories
Find more on Software Development in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!