Read the signal data stored in the file and create a program that displays the waveform
Show older comments
Hi Im new to matlab. Please help me. I want to read the signal data stored in a mat file and create a program that displays the waveform. And I want to display data for a specified particular interval. The signal data is from a sine wave. I have tried to use the load function but I dont know how to use it to plot the graph.
6 Comments
Cynthia Lucy
on 6 May 2021
Edited: Cynthia Lucy
on 6 May 2021
dpb
on 7 May 2021
From the documenation on load the form you used of assigning the result to a variable
S = load(___) loads data into S, using any of the input arguments in the previous syntax group.
- If filename is a MAT-file, then S is a structure array.
- If filename is an ASCII file, then S is a double-precision array
The error about "scalar struct operations" is the clue your variable x is structure, not the array you think it is.
Type
whos x
at the command line and see what it returns.
The fix is to use
load('sec2Harmonics.mat');
which will leave whatever is the variable that was used in the workspace when the .mat file was saved in your workspace.
To see what that was/is use
whos -file sec2Harmonics.mat
Cynthia Lucy
on 7 May 2021
dpb
on 7 May 2021
Moral -- post the actual code and error(s) you get first go 'round -- we only know what we're told; we can't see your terminal from here and so don't know that you did move on to the next step and had an error--all we knew was that you used load and wrote "I have tried to use the load function but I dont know how to use it to plot the graph." which leaves the impression you might have thought somehow MATLAB was to automagically plot something when it was load 'ed.
Cynthia Lucy
on 7 May 2021
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!