[Noob] Blank data -> NaN
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marcel Mariano
am 8 Mär. 2015
Bearbeitet: Marcel Mariano
am 9 Mär. 2015
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?
0 Kommentare
Akzeptierte Antwort
Ken Atwell
am 8 Mär. 2015
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 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!