Plotting a semilogx plot with a table

3 views (last 30 days)
I'm trying to plot two tables (Final & Inital, both 201x2) using the semilogx function.
Here's how I'm trying to do it.
subplot (2,1,1)
semilogx(Initial{:,1},Initial{:,2})
title('Final & Initial Measurements')
xlabel ('Frequency'); ylabel('Magnitude')
hold on
semilogx(Final(:,1),Final(:,2))
xlabel ('Frequency (Hz)'); ylabel('Magnitude (dB)');
legend('InM'+n+'','FM'+n+'');
hold off
But it keeps throwing the error
Error using semilogx
Data must be numeric, datetime, duration or an array convertible to double.
How do I get around this?
Thank you for any help!

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jan 2021
semilogx(Initial{:,1},Initial{:,2})
That line you got right
semilogx(Final(:,1),Final(:,2))
But not that one.
Notice that the first time you used {} indexing but the second time you used ()

More Answers (0)

Categories

Find more on Line Plots 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!