Computational biologist.

Answered

Matrix Multiplication & Splitting

Given your input criteria, you can simply reshape C: sz = size(C, 2); C = reshape(C, 3, 3, sz/3); D = arrayfun(@(i)A*B*C(:,:...

Matrix Multiplication & Splitting

Given your input criteria, you can simply reshape C: sz = size(C, 2); C = reshape(C, 3, 3, sz/3); D = arrayfun(@(i)A*B*C(:,:...

6 days ago | 0

| accepted

Answered

Removing outliers using standard deviation

groupfilter does the trick cleanTable = groupfilter(yourTable, 'Hour', @(x)~isoutlier(x, 'mean'), 'Price');

Removing outliers using standard deviation

groupfilter does the trick cleanTable = groupfilter(yourTable, 'Hour', @(x)~isoutlier(x, 'mean'), 'Price');

7 days ago | 0

| accepted

Answered

Mean for certain conditions

t = readtable('extracted_table.xlsx'); y = groupsummary(t, {'ID', 'Item', 'Snack'}, @mean, 'Rating'); % mean of Rating for each...

Mean for certain conditions

t = readtable('extracted_table.xlsx'); y = groupsummary(t, {'ID', 'Item', 'Snack'}, @mean, 'Rating'); % mean of Rating for each...

18 days ago | 0

| accepted

Answered

how to partition data into testing and training

While I don't see any issues with what MATLAB does nor understand your point, you can use something like this: test_idx = rand...

how to partition data into testing and training

While I don't see any issues with what MATLAB does nor understand your point, you can use something like this: test_idx = rand...

18 days ago | 0

Answered

How to keep only numbers in a cell (.xlsx file)?

x = readcell('test.xlsx') nums = cellfun(@(x)sscanf(x, '%f', 1), x) 1.4420 0.3320 0.3560 0.8530 250.8690...

How to keep only numbers in a cell (.xlsx file)?

x = readcell('test.xlsx') nums = cellfun(@(x)sscanf(x, '%f', 1), x) 1.4420 0.3320 0.3560 0.8530 250.8690...

18 days ago | 1

Answered

fprintf for total sum

doc fprintf An example for a floating point number: X = 2.345674; fprintf('My number is %.2f\n', X) My number is 2.35

fprintf for total sum

doc fprintf An example for a floating point number: X = 2.345674; fprintf('My number is %.2f\n', X) My number is 2.35

18 days ago | 0

| accepted

Answered

Finding the location of the axis end in normalized coordinates

You just missed the fact that end of axis is starting point + width, try this ax=axes(); p=get(ax,'Position'); annotation('...

Finding the location of the axis end in normalized coordinates

You just missed the fact that end of axis is starting point + width, try this ax=axes(); p=get(ax,'Position'); annotation('...

21 days ago | 0

| accepted

Answered

Standarddeviation & mean multiple Matrices

rearrange your matrices into a single 3D matrix. A(:, :, 1) = [1 2; 3 4]; A(:, :, 2) = [5 7; 10 6]; mean(A, 3) 3.0000 ...

Standarddeviation & mean multiple Matrices

rearrange your matrices into a single 3D matrix. A(:, :, 1) = [1 2; 3 4]; A(:, :, 2) = [5 7; 10 6]; mean(A, 3) 3.0000 ...

23 days ago | 0

Answered

delete positions from a matrix according to a given set of conditions based on matrix elements

One possible solution would be: tab = array2table(data); tab1 = groupsummary(tab, {'data3', 'data4'}) % count VAL3 per each la...

delete positions from a matrix according to a given set of conditions based on matrix elements

One possible solution would be: tab = array2table(data); tab1 = groupsummary(tab, {'data3', 'data4'}) % count VAL3 per each la...

23 days ago | 0

| accepted

Answered

extract column index of a particular values in the matrix

B = x1(x1 <= 550 & x1 >= 500);

extract column index of a particular values in the matrix

B = x1(x1 <= 550 & x1 >= 500);

23 days ago | 0

| accepted

Answered

which x value is making maximum this function.

x = 0:0.1:0.4; y1 = -0.893.*x.^2; [maxY1, maxIdx] = max(abs(y1)); x(maxIdx) % your answer is here

which x value is making maximum this function.

x = 0:0.1:0.4; y1 = -0.893.*x.^2; [maxY1, maxIdx] = max(abs(y1)); x(maxIdx) % your answer is here

25 days ago | 1

Answered

Convert an array of letters into numbers

One way would be Map object: alph = 'A':'Z'; num = 1:numel(alph); % or whatever M = containers.Map(string(alph'), num); term...

Convert an array of letters into numbers

One way would be Map object: alph = 'A':'Z'; num = 1:numel(alph); % or whatever M = containers.Map(string(alph'), num); term...

26 days ago | 0

Answered

Capitalize only the first letter of a character

str = "dogs are better than cats"; regexprep(str ,'(\<\w{1})', '${upper($1)}') "Dogs Are Better Than Cats"

Capitalize only the first letter of a character

str = "dogs are better than cats"; regexprep(str ,'(\<\w{1})', '${upper($1)}') "Dogs Are Better Than Cats"

1 month ago | 0

Answered

comparing probability with random draw and choose a transition state

You can construct events by a simple element-wise comparison: events = R < P; event2_num = sum(events, 2); event1_num = sum(...

comparing probability with random draw and choose a transition state

You can construct events by a simple element-wise comparison: events = R < P; event2_num = sum(events, 2); event1_num = sum(...

1 month ago | 0

Answered

Making a 1D array/vector from a table

X = cell2mat(X_cell); % X_cell: your original cell myVec = X(X(:, 3) == 0, 1);

Making a 1D array/vector from a table

X = cell2mat(X_cell); % X_cell: your original cell myVec = X(X(:, 3) == 0, 1);

1 month ago | 1

| accepted

Answered

Reading a matrix from a .txt file

Try this myMat = readmatrix('myfile.txt', 'delimiter', ' ');

Reading a matrix from a .txt file

Try this myMat = readmatrix('myfile.txt', 'delimiter', ' ');

1 month ago | 1

| accepted

Answered

Reversing the order of EVEN rows in an array

d(2:2:end, :) = fliplr(d(2:2:end, :));

Reversing the order of EVEN rows in an array

d(2:2:end, :) = fliplr(d(2:2:end, :));

1 month ago | 0

| accepted

Answered

Error When Using Writetable

test2 variable is the one causing this error. If you want that empty column in your output XLSX file: Table_WLS.test2 = repmat(...

Error When Using Writetable

test2 variable is the one causing this error. If you want that empty column in your output XLSX file: Table_WLS.test2 = repmat(...

1 month ago | 0

| accepted

Answered

Table Mean and Standard Deviation

try this head(x) z1 z2 z3 z4 __ __ __ _______ 7 2 4 0.88646 4 1 ...

Table Mean and Standard Deviation

try this head(x) z1 z2 z3 z4 __ __ __ _______ 7 2 4 0.88646 4 1 ...

1 month ago | 0

Answered

variance explained & pca

pareto only shows the first 10 bars at maximum. You can do it easily with help of cumsum: [~, ~, ~, ~, explained] = pca(rand(10...

variance explained & pca

pareto only shows the first 10 bars at maximum. You can do it easily with help of cumsum: [~, ~, ~, ~, explained] = pca(rand(10...

1 month ago | 1

| accepted

Answered

How can I code the given representations to the labels? (Hats confused me a bit.)

You can find full list of symbols/letter here. But for \hat{x} you can do as: plot(1:10, 1:10, '.-') title('$$\vert$$$$\hat{y}...

How can I code the given representations to the labels? (Hats confused me a bit.)

You can find full list of symbols/letter here. But for \hat{x} you can do as: plot(1:10, 1:10, '.-') title('$$\vert$$$$\hat{y}...

1 month ago | 1

| accepted

Answered

Extract ¨multiple .xls file from a folder?

If you want to extract the content of all your .xls files within a certain directory at once, you can do it as: % assuming you'...

Extract ¨multiple .xls file from a folder?

If you want to extract the content of all your .xls files within a certain directory at once, you can do it as: % assuming you'...

1 month ago | 0

| accepted

Answered

Search string array column for a specific string

Have you tried ismember? You only need column 5, but you fed first argument of strcmp with the whole string array. rowIdx = fin...

Search string array column for a specific string

Have you tried ismember? You only need column 5, but you fed first argument of strcmp with the whole string array. rowIdx = fin...

1 month ago | 0

| accepted

Answered

minimum output matrix from data

A=[ 0 2.8284 5.6569; 2.8284 0 2.8284; 5.6569 2.8284 0; 1.4142 3.162...

minimum output matrix from data

A=[ 0 2.8284 5.6569; 2.8284 0 2.8284; 5.6569 2.8284 0; 1.4142 3.162...

2 months ago | 0

| accepted

Answered

how to select multiple rows from a large matrix and leave 1 row every time

A = rand(20, 100); keepRowsIdx = setdiff(1:size(A, 1), 4:4:size(A, 1)); Columns 1 through 10 1 2 3 5 ...

how to select multiple rows from a large matrix and leave 1 row every time

A = rand(20, 100); keepRowsIdx = setdiff(1:size(A, 1), 4:4:size(A, 1)); Columns 1 through 10 1 2 3 5 ...

2 months ago | 0

| accepted

Answered

You must pass X as a floating-point matrix.

Your TestSet must have the same structure as your Training set. You can try this result = predict(SVMmodel, Labels(:, 1:9));

You must pass X as a floating-point matrix.

Your TestSet must have the same structure as your Training set. You can try this result = predict(SVMmodel, Labels(:, 1:9));

2 months ago | 0

| accepted

Answered

How to create a new parameter in one table based on multiple observations in a second table?

Let's call you first able tabc and the latter tabd. What you bascially need is to first select patients with true events, and th...

How to create a new parameter in one table based on multiple observations in a second table?

Let's call you first able tabc and the latter tabd. What you bascially need is to first select patients with true events, and th...

2 months ago | 1

| accepted

Answered

Replace some values of a vector with values from another vector of the same size

You've missed the fact that k is of logical class: A = [0 0 -3 -8 -10 0 0] B = [-12 -12 -4 -4 -4 -12 -12] k = (A < B) C = A ...

Replace some values of a vector with values from another vector of the same size

You've missed the fact that k is of logical class: A = [0 0 -3 -8 -10 0 0] B = [-12 -12 -4 -4 -4 -12 -12] k = (A < B) C = A ...

2 months ago | 0

| accepted

Answered

Problems with creating a dynamic struct with num2str

First of all you cannot choose a digit as filed name due to the same reason you cannot choose it as a variable name. for i = 1:...

Problems with creating a dynamic struct with num2str

First of all you cannot choose a digit as filed name due to the same reason you cannot choose it as a variable name. for i = 1:...

2 months ago | 1

| accepted