i have an error when i draw a polar The error is

1 vue (au cours des 30 derniers jours)
Aya Emam
Aya Emam le 19 Mai 2023
clc
clear all
close all
path = 'H:\radition';
Date= importdata([path '\radd.csv']);
dB = Date(1:360,3);
% pol_1 = 10*log10(Data(1:121,3)./max(Data(1:121,3)));
Theta = Data(1:361,1)*pi/180;
dB = dB-min(dB);
polarplot (Theta,(dB/50))
hold on
  3 commentaires
Dyuman Joshi
Dyuman Joshi le 19 Mai 2023
Date() has 360 rows, and you are trying to access 361st and 362nd row, which is not possible.
Also, the code in the problem uses 1:360 and the code in the above comment uses 1:362, which is weird.
Adam Danz
Adam Danz le 19 Mai 2023
I believe line 8 is db = Date(1:360,3); in which case Date appears to have only 1 row according to the error message.

Connectez-vous pour commenter.

Réponses (1)

Dyuman Joshi
Dyuman Joshi le 19 Mai 2023
Use readmatrix to directly load the data into a numeric array.
importdata loads the data into a structure array for the given input (i.e. spreadsheet) and does not include the first column in the output (rather it classifies it as rowheaders)
And use the indices within the range of the size of "Date".
%Struct array
out1 = importdata('radd.csv') %size of data is 360x7, it should be 360x8 as below
out1 = struct with fields:
data: [360×7 double] textdata: {360×1 cell} rowheaders: {360×1 cell}
%Numeric array
out2 = readmatrix('radd.csv')
out2 = 360×8
0 90.0000 0.9280 -0.3560 199.4440 -4.9900 54.9850 11.3000 1.0000 90.0000 0.9240 -0.3600 199.0590 -4.9900 54.0570 11.4000 2.0000 90.0000 0.9180 -0.3680 198.6710 -5.0000 53.1350 11.6000 3.0000 90.0000 0.9080 -0.3790 198.2810 -5.0000 52.2200 11.7000 4.0000 90.0000 0.8950 -0.3940 197.8900 -5.0100 51.3120 11.8000 5.0000 90.0000 0.8800 -0.4130 197.4960 -5.0100 50.4110 12.0000 6.0000 90.0000 0.8620 -0.4350 197.1010 -5.0200 49.5180 12.1000 7.0000 90.0000 0.8400 -0.4610 196.7040 -5.0300 48.6330 12.2000 8.0000 90.0000 0.8160 -0.4910 196.3050 -5.0400 47.7550 12.3000 9.0000 90.0000 0.7890 -0.5250 195.9040 -5.0400 46.8860 12.4000

Community Treasure Hunt

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

Start Hunting!

Translated by