matlab-table

Filter on words in Matlab tables (as in Excel)

僤鯓⒐⒋嵵緔 提交于 2020-01-04 15:49:12
问题 In Excel you can use the "filter" function to find certain words in your columns. I want to do this in Matlab over the entire table. Using the Matlab example-table "patients.dat" as example; my first idea was to use: patients.Gender=={'Female'} which does not work. strcmp(patients.Gender,{'Female'}) workd only in one column ("Gender"). My problem: I have a table with different words say 'A','B','bananas','apples',.... spread out in an arbitrary manner in the columns of the table. I only want

Filter on words in Matlab tables (as in Excel)

半世苍凉 提交于 2020-01-04 15:49:05
问题 In Excel you can use the "filter" function to find certain words in your columns. I want to do this in Matlab over the entire table. Using the Matlab example-table "patients.dat" as example; my first idea was to use: patients.Gender=={'Female'} which does not work. strcmp(patients.Gender,{'Female'}) workd only in one column ("Gender"). My problem: I have a table with different words say 'A','B','bananas','apples',.... spread out in an arbitrary manner in the columns of the table. I only want

writetable replace NaN with blanks in Matlab

為{幸葍}努か 提交于 2019-12-23 02:34:09
问题 Given a Matlab table that contains many NaN , how can I write this table as an excel or csv files where the NaN are replaced by blanks? I use the following function: T = table(NaN(5,2),'VariableNames',{'A','C'}) writetable(T, filename) I do not want to replace it with zeros . I want that the output file: has blanks for NaN and that the variable names are included in the output. 回答1: You just need xlswrite for that. It replaces NaN s with blanks itself. Use table2cell or the combination of

how to import a matlab table in R

你说的曾经没有我的故事 提交于 2019-12-11 10:17:39
问题 I have a matlab .mat file with table data type which I want to import in R. I am using 'readMat' for this and R is reading it as a List. After that is there a way to convert the list into either a dataframe or table format in R? When I use as.dataframe I get the following error : Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 5, 6, 1 A possible workaround I thought of is to export the table as a .csv from matlab

Unable to create an array from a table

若如初见. 提交于 2019-12-11 07:34:31
问题 I'm trying to load an external CSV file using MATLAB. I managed to download it using webread , but I only need a subset of the columns. I tried Tb = webread('https://datahub.io/machine-learning/iris/r/iris.csv'); X = [sepallength sepalwidth petallength petalwidth]; But I cannot form X this way because the names are not recognized. How can I create X correctly? 回答1: The line Tb = webread('https://datahub.io/machine-learning/iris/r/iris.csv'); Produces a table object with column names you later

Create an index to table

寵の児 提交于 2019-12-11 06:45:44
问题 I have a table T as below: T = table({'A';'A';'B';'B';'B';'B';'C';'C';'D';'D'},... {'xd';'z';'x';'y';'z';'w';'x';'wh';'z';'w'},... [4;2;4;1;2;5;2;1;1;5], ... 'VariableNames', {'memberId', 'productId','Rating'}); T = memberId productId Rating ________ _________ ______ 'A' 'xd' 4 'A' 'z' 2 'B' 'x' 4 'B' 'y' 1 'B' 'z' 2 'B' 'w' 5 'C' 'x' 2 'C' 'wh' 1 'D' 'z' 1 'D' 'w' 5 I need to index it by memberId and productId so the result is: A: {'xd' 'z'} B: {'x' 'y' 'z' 'w'} C: {'x' 'wh'} ....... 回答1:

Adding multiple rows of a table to another table

被刻印的时光 ゝ 提交于 2019-12-11 06:21:19
问题 I have a table as below : (This is a few lines from my table) T = table({'A';'A';'A';'B';'B';'B';'C';'C';'C';'C'}, {'x';'y';'z';'x';'w';'t';'z';'x';'t';'o'},[5;1;2;2;4;2;2;5;4;1], ... 'VariableNames', {'memberId', 'productId','Rating'}); T: A x 5 A y 1 Z z 2 B x 2 B w 4 B t 2 C z 2 C x 5 C t 4 C o 1 C u 3 D r 1 D t 2 D w 5 . . . . I need to take the user A then Create a table like Previous table (Table T) and All rows are related to the user A to enter that table.At this point in the table

writetable replace NaN with blanks in Matlab

别来无恙 提交于 2019-12-08 15:27:36
Given a Matlab table that contains many NaN , how can I write this table as an excel or csv files where the NaN are replaced by blanks? I use the following function: T = table(NaN(5,2),'VariableNames',{'A','C'}) writetable(T, filename) I do not want to replace it with zeros . I want that the output file: has blanks for NaN and that the variable names are included in the output. You just need xlswrite for that. It replaces NaN s with blanks itself. Use table2cell or the combination of table2array and num2cell to convert your table to a cell array first. Use the VariableNames property of the

How to use tables in older versions of Matlab? [duplicate]

允我心安 提交于 2019-12-01 08:48:12
问题 This question already has answers here : Display matrix with row and column labels (6 answers) Closed 5 years ago . Is there any function in MATLAB 2010 or below versions to print a result (eg: Some matrices) in tabular form? All I got from googling was a table() function that works only in MATLAB 2013 or above versions. I've got MATLAB 2010 in my machine and it's not practical to download a newer version as it is very large and I'm in a hurry. Thank you. 回答1: For Matlab versions 2012 and

Display matrix with row and column labels

ぃ、小莉子 提交于 2019-11-27 08:51:53
Is there a convenient way to display a matrix with row and column labels in the Matlab terminal? Something like this: M = rand(5); displaymatrix(M, {'FOO','BAR','BAZ','BUZZ','FUZZ'}, ... {'ROW1','ROW2','ROW3','ROW4','ROW5'}); %?? yielding: FOO BAR BAZ BUZZ FUZZ ROW1 0.1622 0.4505 0.1067 0.4314 0.8530 ROW2 0.7943 0.0838 0.9619 0.9106 0.6221 ROW3 0.3112 0.2290 0.0046 0.1818 0.3510 ROW4 0.5285 0.9133 0.7749 0.2638 0.5132 ROW5 0.1656 0.1524 0.8173 0.1455 0.4018 Even better would be something with some ASCII-art niceties: | FOO BAR BAZ BUZZ FUZZ -----+-----------------------------------------------