How do I polar plot an array from an imported file in matlab?
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Pawel Jastrzebski
2018-3-23
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:
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!