index rows containing specific value
4 views (last 30 days)
Show older comments
Hello everyone
I've a cell 352X79. The first row contains the marker names. The first column contains the filenames.
Now i need to find all the NaN values and write the row containing the NaN to a new variable X, so I have all colums with NaN values in one variable.
Or is it even possible to get the filename and the names of the NaN marker into the new variable? So it woul look like X(1,1) = filname, X(1,2) = markar_Name etc.
Thanks for your help!
4 Comments
Accepted Answer
Stephen23
on 26 Mar 2016
Edited: Stephen23
on 26 Mar 2016
Using a cell array is a total waste of MATLAB's abilites for processing numeric arrays quickly and efficiently. You would be much better off storing the data in three arrays (col-names, row-names, numeric data), or (even better) in a table. Whatever method you use for processing a cell array of mixed data is going to be much more complicated that if you simply stored your numeric data in a numeric array.
Here is an example showing how simple this task can be when the data is stored in a simple numeric array:
colC = {'marker1',' marker2'};
rowC = {'testvpn1','testvpn2','testvpn3'};
mat = [5,NaN;1,0;6,NaN] % your data
[idxR,idxC] = find(isnan(mat))
[colC(idxC),rowC(idxR)]
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!