How can i set a specific and irregular tick on a Matlab axis?

允我心安 提交于 2019-12-13 03:49:28

问题


With Open-BCI, i got values (sampled at 255Hz) that i want to plot on matlab. However, i would like specific ticks on the x axis (i think it's the correct term) to match the acquisition protocol. It follows a 6-2-6-2 seconds pattern. What i mean is :

- T=0s => xtick="Image1"
- T=6s => xtick="Image2"
- T=8s => xtick="Image3"
- T=14s => xtick="Image4"
- T=16s => xtick="Image5"
etc...

I want to plot the whole signal, and then change the X axis ticks to show only those values. However i struggle with matlab, so i have no idea how to do that. I'm not sure it's even possible.

Thank you, if you could help me


回答1:


Try setting your desired ticks in a matrix (e.g., "myticks" below).

x = [1 2 3 4 5];
figure
plot(x,x)
myticks = [1 3 3.5 4];
xticks(myticks)

yields this:



来源:https://stackoverflow.com/questions/55314903/how-can-i-set-a-specific-and-irregular-tick-on-a-matlab-axis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!