how use append function to update table after if loop?

조회 수: 4 (최근 30일)
MANALI DODIYA
MANALI DODIYA 2018년 8월 21일
답변: Walter Roberson 2018년 8월 21일
table=readtable('950 RPM11.xlsx');
i=5
Q=table(1:269,i);
for j=1:9:262
C=(table{j,i}-flowrate);
if C<=+5 & C>=-5
Pitch = table{j,3}
Diameter = table{j,2}
Rotation = table{1,1}
Flowrate = table{j,i}
t=[Pitch Diameter Rotation Flowrate];
fig = figure('Position', [500 250 500 300]);
T1=uitable('parent',fig,'Position',[100 100 265.5 150],'Data',t);
T1.ColumnName= {'Pitch','Diameter','Rotation','Flowrate'};
end
end
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 8월 21일
When you say "append function": are you trying to append to the table object, or are you trying to append to the uitable T1 ?
MANALI DODIYA
MANALI DODIYA 2018년 8월 21일
yes, I want to append uitable T1.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 8월 21일
I recommend against doing that. I recommend instead building the entire table ahead of time.
You can use logical indexing to select rows out of your table, and then you can convert the subset to cell and set the uitable data parameter to the cell.
It is not good practice to use table as a variable name: at the very least you are going to confuse readers, and you are going to have problems the next time that you try to create a table.

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by