Operands on table, comparison with numbers
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mihai Milea
am 26 Nov. 2020
Kommentiert: Mihai Milea
am 27 Nov. 2020
Hi .I have a table after reading a csv file with readtable .I attached a sample file .Say I get a table A after reading.
say I fix one of the row indices " ind" .If I try say find(A(ind,:)>0.1) I get the error : "Operation '>' not supported for operands of type table " .In general how do I just go back to some classic matrix from a table ignoring these Variable names?
I tried table2array but with no luck .Many thanks
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 26 Nov. 2020
say I fix one of the row indices " ind" .If I try say find(A(ind,:)>0.1) I get the error : "Operation '>' not supported for operands of type table " .In general how do I just go back to some classic matrix from a table ignoring these Variable names?
There's no guarantee you can "slice" the table across rows -- the variables may contain data of different data types.
load patients
T = table(LastName, Gender, Age, Smoker);
head(T)
But if you can, you can use curly braces to extract the data into a numeric array.
A = magic(4)
T2 = array2table(A)
T2{3, :} % The same as A(3, :)
Weitere Antworten (1)
KSSV
am 26 Nov. 2020
You have to access the columns of Table T using T.(1), T.(2) etc,
Read about accessing the columns from tatble. If you have names to the columns, you can use
T.col1, T.col2 etc to access the respective columns.
3 Kommentare
Siehe auch
Kategorien
Mehr zu Data Import and Analysis 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!