Vector against a single value

조회 수: 4 (최근 30일)
ARN
ARN 2019년 10월 31일
편집: Adam Danz 2019년 11월 5일
I have a data set a which contains 100 structures. All the structure contains two fields timevector(8192x1) and power(1x1).
TimeVector=zeros(length(a(1).timevector*length(a)),1)
Power=zeros(length(a(1).Powerdb),1)
for i=1:length(a)
Time=a(i).timevector;
Power=vertcat(a(i).Powerdb);
end
Now i need to make a data set , which should be as the attached picture format.
I cant seem to concatenate Timevector as i want to...
Thanks,
  댓글 수: 1
Turlough Hughes
Turlough Hughes 2019년 10월 31일
Probably best to just upload the data set.

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2019년 10월 31일
편집: Adam Danz 2019년 11월 5일
% Create fake data for testing
for i = 1:10
a(i).timevector = rand(8192,1);
a(i).power = randi(10)+5;
end
% Create the table
T = [table({a.timevector}','VariableNames',{'TimeVector'}), table([a.power]','VariableNames', {'Power'})];
Results
head(T) %shows the first few rows
ans =
8×2 table
TimeVector Power
_______________ _____
{8192×1 double} 8
{8192×1 double} 13
{8192×1 double} 12
{8192×1 double} 8
{8192×1 double} 7
{8192×1 double} 6
{8192×1 double} 10
{8192×1 double} 15

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by