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

2 ビュー (過去 30 日間)
jon
jon 2018 年 3 月 23 日
コメント済み: jon 2018 年 3 月 24 日
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

採用された回答

Pawel Jastrzebski
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:
  1 件のコメント
jon
jon 2018 年 3 月 24 日
This worked perfectly for me. Thank you so much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by