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!

 Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 3 Mai 2017

0 votes

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by