# How to remove NaN from data read from excel?

5 ビュー (過去 30 日間)
Vishnuvardhan Naidu Tanga 2022 年 7 月 14 日
Hello all,
I am trying to solve a simple equation in matlab from the excel data. But I am getting NaN values as the data in the excel is not same in every row. How can i remove the NaN values? Please help me.
My code:
data = table2array(Z);
A = sqrt((2/3).*data(:,5));
O = A./data(:,4);
subplot(4,2,1)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,3), abs(O), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 50')
C = sqrt((2/3).*data(:,8));
Q = C./data(:,7);
subplot(4,2,2)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,6), abs(Q), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 60')
E = sqrt((2/3).*data(:,11));
S = E./data(:,10);
subplot(4,2,3)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,9), abs(S), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 70')
G = sqrt((2/3).*data(:,14));
U = G./data(:,13);
subplot(4,2,4)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,12), abs(U), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 80')
H = sqrt((2/3).*data(:,17));
V = H./data(:,16);
subplot(4,2,5)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,15), abs(V), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 90')
I = sqrt((2/3).*data(:,20));
W = I./data(:,19);
subplot(4,2,6)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,18), abs(W), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 100')
J = sqrt((2/3).*data(:,23));
X = J./data(:,22);
subplot(4,2,7)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,21), abs(X), 'linewidth', 2);
hold off
legend('Panchapaksan data-{u\prime}/U_s', 'RSM', 'Location', 'northeastoutside');
xlabel('r/L_u');
ylabel('{u\prime}/U_s');
title('At X/D = 110')
J = sqrt((2/3).*data(:,26));
X = J./data(:,25);
subplot(4,2,8)
plot(data(:,1), data(:,2), 'linewidth', 2);
hold on
plot(data(:,24), abs(X), 'linewidth', 2);
hold off
##### 8 件のコメント表示 7 件の古いコメント非表示 7 件の古いコメント
Vishnuvardhan Naidu Tanga 2022 年 7 月 14 日
Hello I have found my desired solution. Thank you for your response. @Dyuman Joshi and @KSSV

サインインしてコメントする。

### カテゴリ

Find more on Spreadsheets in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by