Hi guys, i just started learning using MATLAB. I am following the "MATLAB for neuroscientist" textbook's examples. I came across this code that won't work:
if true
% code
end
figure
for ii = 1:9
subplot(3,3,ii)
h = bar(1,1)
set(h,'FaceColor',[0 0 ii/9])
end
This code i copied it from the text book in this exact way but when i try to run it it says: Attempt to execute SCRIPT subplot as a function: D:\Program Files\MATLAB\R2013a\bin\subplot.m
Error in subplot (line 3) subplot(3,3,ii)
obviously i can't understand where the problem is, thank you in advance!

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2017년 5월 3일

0 개 추천

You probably saved your file as subplot.m
It conflicts with the subplot() function and built-in subplot.m
Name it something else.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by