v = [0:1:100] without numbers that can be divided by 5

4 views (last 30 days)
Hello,
I was wondering if there is any way to put in a vector going from 0 to 100 in steps of 1. The problem is the fact that I don't want any multiplications of 5 in this vector...
I want to do this because I made this efficiency plot (contourf), in which the efficiencies are plotted in steps of 1%. Every 1%-line is a dotted line, while every 5%-line is a full line with a label on it. The problem is that at every 5%-line, there still is a dotted 1%-line underneath it, so when I put my label in, the 5%-line breaks but the 1%-line shows up.
This is my code for plotting:
%Graph title?
header = '(IM) Motor + Pump efficiency';
%Which efficiency to plot?
plotEfficiency = EffMotorHydrDriveIM;
%PLOT NP EFFICIENCY
figure;
ax(1) = axes('Box','off','position',[0.08 0.08 0.77 0.73]);
xlabel('Q [l/min]','fontsize',20)
ylabel('P [Bar]','fontsize',20)
title(header,'fontsize',30,'Units','Normalized','position',[0.55 1.15],'interpreter','latex')
colorbar('position',[0.92 0.08 0.02 0.73]);
caxis([4,73]);
hold on;
Vals = [0:1:100];
contourf(QdriveIM,PdriveIM,plotEfficiency,Vals,'EdgeColor','k','LineWidth',1.2,'LineStyle',':');
Vals = [0:5:100];
[C,h] = contour(QdriveIM,PdriveIM,plotEfficiency,Vals,'EdgeColor','k','LineWidth',1.2);
clabel(C,h,'Fontsize',10,'Color','k')
hold off;
%PLOT N-T axes
ax(2) = axes('Position',get(ax(1),'position'),...
'HitTest','off',...
'XAxisLocation','top',...
'YAxisLocation','right',...
'XLim',[NdriveIM(1,1) NdriveIM(1,end)],...
'YLim',[TdriveIM(1,1) TdriveIM(end,1)],...
'Color','none');
xlabel(ax(2),'N [RPM]','fontsize',20)
ylabel(ax(2),'T [Nm]','fontsize',20)

Accepted Answer

Mischa Kim
Mischa Kim on 24 Mar 2014
Edited: Mischa Kim on 24 Mar 2014
Andries, use the mod command:
v = 0:1:100;
v(mod(v,5)==0) = []; % remove numbers divisible by 5

More Answers (0)

Community Treasure Hunt

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

Start Hunting!