Can you please help me to get the square root of the sum of squares of the second column in the text file ?

조회 수: 2 (최근 30일)
Hello everyone, Thank you for reading this query. I need some help to read the text file attached and replace the NaN with the 0 and also find the square root of the sum of squares for the second column and store the result to a certain variable. Can you help me with the code?
  댓글 수: 4

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

채택된 답변

Matt J
Matt J 2022년 9월 28일
편집: Matt J 2022년 9월 28일
Your attachment didn't make it, but assuming it's called yourFile.txt,
[~,col]=readvars('yourFile.txt');
result = norm(col(~isnan(col)));
  댓글 수: 7
Matt J
Matt J 2022년 9월 29일
편집: Matt J 2022년 9월 29일
@Phenicia assuming you are also @Adeline War,
You're quite welcome, but please Accept-click the answer to certify that.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by