Dynamic array for string
조회 수: 6 (최근 30일)
이전 댓글 표시
D = 0.067;
Ugs = [0.047,0.061,0.288,0.344,0.404,0.544,0.709,0.945,1.418,1.891,2.363,2.836,4.727];
Uls = ones(1,13)*0.047;
L = 6.0000;
g = 9.81;
% Um=zeros(Ugs.size);
Um = Ugs + Uls;
Le = 42.6 * D *((Um/((g*D)^0.5))+0.29);
for i = 1:13
if L < Le:13
flow='churn'
else
if L >= Le:13
flow='slug'
arrow(i,:) = flow;
end
end
end
Ugs = Ugs.';
Le = Le.';
Um = Um.';
flow = flow.';
Uls = Uls.';
P = plot(Le,Um)
T = table(Uls,Ugs,Le,Um,arrow)
댓글 수: 0
채택된 답변
Mehmed Saad
2020년 5월 13일
편집: Mehmed Saad
2020년 5월 13일
cells are used for that purpose
arrow{i} = flow;% braces changed
Take transpose of arrow like you are doing for other variables
also this line will give you error.
if L >= Le:13
for indexing replace Le:13 with Le(i)
the final table you will get is
T =
13×5 table
Uls Ugs Le Um arrow
_____ _____ ______ _____ _______
0.047 0.047 1.1587 0.094 'slug'
0.047 0.061 1.2079 0.108 'slug'
0.047 0.288 2.0071 0.335 'slug'
0.047 0.344 2.2043 0.391 'slug'
0.047 0.404 2.4155 0.451 'slug'
0.047 0.544 2.9084 0.591 'slug'
0.047 0.709 3.4893 0.756 'slug'
0.047 0.945 4.3201 0.992 'slug'
0.047 1.418 5.9853 1.465 'slug'
0.047 1.891 7.6506 1.938 'churn'
0.047 2.363 9.3123 2.41 'churn'
0.047 2.836 10.978 2.883 'churn'
0.047 4.727 17.635 4.774 'churn'
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Install Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!