필터 지우기
필터 지우기

[Noob] Blank data -> NaN

조회 수: 2 (최근 30일)
Marcel Mariano
Marcel Mariano 2015년 3월 8일
편집: Marcel Mariano 2015년 3월 9일
I'm trying to use matlab to get a porfolio optimization.
I import excel data of a bunch of investment funds, but where some funds have over 60 trimesters of data, some have only 20. When matlab imports the data, it fills the blank spaces with NaN and doesn't run portopt because it has NaN values.
How can I solve this?

채택된 답변

Ken Atwell
Ken Atwell 2015년 3월 8일
I'm not familiar with portopt, so this will be general advise:
You can de-NaN a vector of numbers with logical index:
>> t = [1 nan 2 nan 3 nan]
t =
1 NaN 2 NaN 3 NaN
>> t = t(~isnan(t))
t =
1 2 3
The second statement, "in English", is: "Replace t with a new vector that contains only those elements in t that are non-NaN."
  댓글 수: 1
Marcel Mariano
Marcel Mariano 2015년 3월 9일
편집: Marcel Mariano 2015년 3월 9일
Hi
The command turned a Numeric Matrix into a Column. The original problem I'm facing is in the image.
But thanks for the tip. I'll try to adapt it somehow.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Portfolio Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by