Reputation: 9
Here is a bit of detail, I am from C++ old language background, while resolving Matlab question asked by my teacher. I am given a mat file which contains real data, and I need to read it, assign the values to 2-D array, as a spike of waveform is a 2-D array. Plot it on X and Y axis. Then I need to make a threshold by looking at spikes that most spikes are between, e.g, a range of this number so chop of the extra bit over, and take only spike (2-D array) which have under a certain threshold. Spike means a simple signal which you see when a patient is sick and its heart beat is showing on screen. My data file is 313 Mb in size. So can anyone guide me how to deal with this big file as well.
So any help code would be great.
Upvotes: 0
Views: 741
Reputation: 293
First load your .mat file into the current workspace:
load(filename)
filename would be something like 'data.mat'
After this you should have your 2D array in the workspace...let's assume it's named 'data'. If the first row is the X axis and the second row is the Y axis, then use:
plot(data(1,:), data(2,:))
The ':' in MATLAB selects every column in the 2D array. You can then use the following to find all indexes of values over your threshold:
indexes = find(data(1,:) > threshold)
If you want to saturate these values at your threshold, then do:
data(1,indexes) = threshold
The size of your .mat file shouldn't change anything other than how long each function takes to complete.
Edit: You were vague and unclear in your problem statement, so hopefully I understood you correctly. Let me know if I didn't understand what you wanted.
Upvotes: 1
Reputation: 495
Type the following in Matlab:
help load
Read it. Then type:
help plot
Read it. Make a start on your problem, then come back for help.
Upvotes: 1