How can I use the markers in SPTOOL to crop and save portions of my signal in the Signal Processing Toolbox 6.2 (R14)?

D
Declan · Mar 15, 2021 · 2.3K views
Question
I am using SPTOOL to graphically view my signal. I would like to use the vertical markers to crop and save portions of my signal.  
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 25, 2026
The ability to crop and save portions of a signal using the vertical markers in SPTOOL is not available in the Signal Processing Toolbox 6.2 (R14).
 
To work around this issue, try exporting the position of the markers from the Signal Browser, determining the corresponding indices of the data that constitutes the signal, and using the indices to generate a cropped signal. The following example demonstrates this approach using the "train" signal that ships with MATLAB:
 
1. Type the following at the  MATLAB prompt to load a sample signal in the workspace and start SPTool:
 
load train

sptool
2. Choose "train" and select "View" under the signals portion of the SPTool startup window.
 
3. Position the markers in the main display area of the Signal Browser window.
 
4. Select Markers -> Export... and enter "marker_struct" as the name of the marker structure to be saved in the workspace.
 
5. Issue the following at the MATLAB prompt to crop and save the portion of the signal demarcated by the markers:
 
 
max_time = length(y)/Fs;

index_1 = round(marker_struct.x1/max_time * (length(y)-1)+1);

index_2 = round(marker_struct.x2/max_time * (length(y)-1)+1);

cropped_signal = y(index_1:index_2);

save myfilename cropped_signal Fs
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!