필터 지우기
필터 지우기

Creating iddata from data in tables

조회 수: 21 (최근 30일)
Bill Tubbs
Bill Tubbs 2020년 3월 22일
댓글: Bill Tubbs 2020년 3월 27일
I guess iddata won't accept data from a table.
>> dataTable(1:5,:)
ans =
5×5 table
Time H1 H2 T1 T2
____ __ __ _____ _____
0 0 0 21.23 21.23
1 0 0 21.55 21.55
2 0 0 21.55 21.55
3 0 0 21.87 21.55
4 0 0 21.55 21.23
>> dataSet = iddata(dataTable(:,4:5),dataTable(:,2:3));
Error using iddata (line 193)
The value of the "OutputData" property must be a double matrix or a cell array of such matrices.
Is this the only or best solution?
>> inputData = table2array(dataTable(:,2:3));
>> outputData = table2array(dataTable(:,4:5));
>> dataSet = iddata(outputData,inputData);

채택된 답변

Sourabh Kondapaka
Sourabh Kondapaka 2020년 3월 27일
Hi,
Instead of indexing based on paranthesis “()” you can use curly braces “{}” to
extract the cell array within the table.
% Instead of :
inputData = table2array(dataTable(:,2:3));
outputData = table2array(dataTable(:,4:5));
dataSet = iddata(outputData,inputData);
% You can do something much simpler:
dataSet = iddata( dataTable{:,4:5}, dataTable{:,2:3} );
Here is a sample table which demonstrates the same thing as above:
t = table;
t.Time = (0:1:100)';
t.H1 = zeros(101,1);
t.H2 = zeros(101,1);
t.T1 = zeros(101, 1) + 23.25;
t.T2 = zeros(101, 1) + 21.53;
dataset = iddata(t{:,4:5}, t{:,2:3});
For more information on indexing in matlab check here and here
A similar question has been answered here
  댓글 수: 1
Bill Tubbs
Bill Tubbs 2020년 3월 27일
Evidently I don't understand MATLAB indexing... Thanks for the links!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Transfer Function Models에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by