Replacing NaN with last real value
    4 views (last 30 days)
  
       Show older comments
    
    Diego Dranuta
 on 15 Jan 2020
  
    
    
    
    
    Commented: Asliddin Komilov
 on 17 Jan 2020
            Hi folks, I have hundreds of excel files in .csv format that I have to "clean" getting rid of all teh NaN values and replacin them by the last value.
I have tryied using the repnan function but somethinf seems wrong.
Here is what i did
xlsread ECUSIMTEST0000-000-01.csv
for k=1:size(ans,2)
    ans(:,k) = repnan(ans(:,k),"previous")
end
Where ans is the double imported from excel. I am a beginner in matlab so no step is trivial to me.
Thanks !!!
0 Comments
Accepted Answer
  Star Strider
      
      
 on 15 Jan 2020
        3 Comments
  Asliddin Komilov
 on 17 Jan 2020
				I have  set of 25 variables (matrices), can I have repliced all zero value to NAN in all of the at once, without doing it for each of them separately?
thanks
More Answers (0)
See Also
Categories
				Find more on Get Started with MATLAB 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!

