Invalid Data Arguement when plotting

2 visualizaciones (últimos 30 días)
Christopher Pineda
Christopher Pineda el 27 de Oct. de 2021
Respondida: Anshika Chourasia el 6 de Dic. de 2021
Using a imported xlsx file with data, been trying to plot 2 different coloumns on 1 graph as shown below. However, I am getting 'error using plot. Invalid data arguement'. Both columns have the same amount of cells.
opts = spreadsheetImportOptions("NumVariables", 6);
% Specify sheet and range
opts.Sheet = "level 1";
opts.DataRange = "A2:F5121";
% Specify column names and types
opts.VariableNames = ["X_Value", "Real", "Imaginary", "Magnitude", "Phase", "Coherence"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double"];
% Import the data
lab2data = readtable('data29.xlsx');
% Plot Magnitude vs Frequency
M1 = lab2data.Magnitude(1:end);
F1 = lab2data.X_Value(1:end);
figure(1)
hold on
plot(F1, M1)
hold off
  1 comentario
Walter Roberson
Walter Roberson el 27 de Oct. de 2021
Why do you construct opts but then not use it?

Iniciar sesión para comentar.

Respuestas (1)

Anshika Chourasia
Anshika Chourasia el 6 de Dic. de 2021
Hi,
Please cross-check the correctness of the data file and refer the “readtable” function syntax for creating table from spreadsheets.
If the error stills persist, please provide more information to further investigate into the problem.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by