I'm now using Arduino Nano to output some analog signals in voltage, and save these data as text file using CoolTerm. And when I plot this text file in terms of seconds in Matlab, I realize the sampling rate is not fixed because the number of samples per seconds are not constant. I'm wondering if there's any methods can fix the sampling rate to 250 Hz either by software or hardware? Thanks a lot for your help.
Yes, simply use the millis() function or the micros() function. Have a look at the "blink without delay" example sketch for how to use millis(). The micros() function can be used in just the same way, except the values are 1000x higher of course.
If you can't make that work, post you attempt here (use code tags) and we can help.
When timing is critical, I would recommend setting up a timer interrupt to execute at periodic intervals and putting the code that reads the analogs signal into the interrupt service routine.