Hi all,
I am preparing calculated parameters into a table that will be appended to an excel file for eventual data analysis using R.
Each data set has four identifiers: sampletype, strain, scan, and samplenumber. The identifiers are single cells/characters. These identifiers are constant for the calculated parameters: peaks, width, localheight. The calculated parameters are doubles that are the same length (ranging from 1×5 to 1×9 depending on the data set).
I would like the data to look like this in the table:
sampletype strain scan samplenumber peaks width localheight
example 10 1 1 100 50 95
example 10 1 1 101 46 103
example 10 1 1 103 50 95
example 10 1 1 99 60 90
example 10 1 1 80 52 110
example 10 1 1 91 54 98
example 10 1 1 94 49 99
I want the single cells/characters to 'fill down' the column until the end of the double parameters length, which will change with every data set. So, after running two data sets the eventual excel file would look like:
sampletype strain scan samplenumber peaks width localheight
example 10 1 1 100 50 95
example 10 1 1 101 46 103
example 10 1 1 103 50 95
example 10 1 1 99 60 90
example 10 1 1 80 52 110
example 10 1 1 91 54 98
example 10 1 1 94 49 99
example 10 1 2 110 30 80
example 10 1 2 115 31 81
example 10 1 2 111 28 82
My current code is:
sampletype = string(test_name{1}); strain = string(test_name{2}); scan = string(test_name{3}); samplenumber = string(txt{1,1});% Change the parameter rows into parameter columns
peaks=peaks'; width=width'; localheight=localheight' sample_table = table(sampletype,strain,scan,samplenumber,peaks,width,localheight);writetable(sample_table,'sample_sizes.xlsx')
Not surprisingly, I get the following error:
Error using table (line 231)All table variables must have the same number of rows.
I cant figure out how to make a table and filling down a column with a specfic value. I found "missingvalue" but it seems I need to create a table to use the function, and I can't even make a table. Any advice is appreciated!
Best Answer