Dynamic array for string

조회 수: 6 (최근 30일)
Temidayo BOBOYE
Temidayo BOBOYE 2020년 5월 13일
편집: Mehmed Saad 2020년 5월 13일
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)

채택된 답변

Mehmed Saad
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개)

카테고리

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by