Error in running the code

1 view (last 30 days)
Aya Emam
Aya Emam on 30 Jan 2023
Commented: Aya Emam on 30 Jan 2023
Any one can help me
  5 Comments
Aya Emam
Aya Emam on 30 Jan 2023
clear all; %#ok<CLALL>
close all;
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A=dlmread('Book5 measured - Copy (2).csv');
x=A(:,1); % it contains frequency column
y=A(:,2); % it contains Peak gain for phi=0 and theta=90 coloumn which is 2nd column.
plot(x,y,'-r','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',13)
hold on
This the code
and This is error
Trouble reading 'Numeric' field from file (row number 1, field number 1) ==> "2.000000000000000E+009
","-1.893568374385968E+001 "\n
Error in comaesion11 (line 5)
A=dlmread('Book5 measured - Copy (2).csv');
and this is the excel sheet

Sign in to comment.

Answers (1)

Jan
Jan on 30 Jan 2023
dlmread cannot handle the double quotes around the numbers. Use modern import functions instead, e.g. readmatrix(). The option 'TrimNonNumeric' might be useful.
  1 Comment
Aya Emam
Aya Emam on 30 Jan 2023
can you give me example for the read matrix
this is the code
clear all; %#ok<CLALL>
close all;
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A=dlmread('Book5 measured - Copy (3).csv');
x=A(:,1); % it contains frequency column
y=A(:,2); % it contains Peak gain for phi=0 and theta=90 coloumn which is 2nd column.
plot(x,y,'-r','LineWidth',1,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','g',...
'MarkerSize',13)
hold on

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!