How do I polar plot an array from an imported file in matlab?

4 visualizaciones (últimos 30 días)
jon
jon el 23 de Mzo. de 2018
Comentada: jon el 24 de Mzo. de 2018
Hi all, I have a file containing some data, with multiple rows (Time dependent) and 4 fixed columns. I want to polar plot this data such that:
0 - 90 degrees represents column 1
91 - 180 degrees represents column 2
181 - 270 degrees represents column 3
271 - 360 degrees represents column 4
Should any of the values in the column exceed the value of 1000 it will be shown on a given radius marker on the plot
Would it be possible to actually show my data in this manner?
Here is my code:
A = csvread('Polarplottest.txt');
B = A>1000
C = all(B, 2);
C = all(B(:,[1,2,3]), 2);% PowerGrip
D = all(B(:,[1,2,4]), 2);%PowerGrip
F = all(B(:,[1,3]), 2); % PrecisionGrip(Upper)
G = all(B(:,[2,4]), 2); %PrecisionGrip(Lower)
E = cell( size(C) ); % Make a cell array to hold strings, same size as C
E(:) = {'none'}; % Fill all rows with "none" to start. Could use repmat() to create E...
E(C | D) = {'PowerGrip'};
E( F & not(C | D | G) ) = {'PrecisionGrip(Upper)'};
E( G & not(C | D | F)) = {'PrecisionGrip(Lower)'};
T = array2table(A)
T.Desc = E

Respuesta aceptada

Pawel Jastrzebski
Pawel Jastrzebski el 23 de Mzo. de 2018
Would this be in line with what you're trying to achieve?
% Example data
% 4 columns of random of values between 650 and 1050
t = array2table(randi([600,1050],50,4));
t.Properties.VariableNames = {'colA','colB','colC','colD'}
% get all data and store as vector:
allData = t{:,:};
allData = reshape(allData,[],1)
% create the angle vector:
angleVect = linspace(0,2*pi,length(allData))
%plot the polar plot
figure
polarplot(angleVect, allData,'--.r')
% add markers for 'allData' > 1000
hold on
polarscatter(...
angleVect(allData>1000),...
allData(allData >1000),...
'ko')
Outcome:

Más respuestas (0)

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by