Why do I get NaN?
First, Height is already double, so A = 2; str2double(A) Secondly, first element of Height is NaN. Remove it prior to the ana...

2 months ago | 0

why does fitlme with a random effect gives the same results to fitlme without the random effect
This shows the model fits well with only fixed effect and there is no variance left for random effects. Also, your observations ...

2 months ago | 0

Submitted

bfilereader: Efficient processing of big delimited files in MATLAB

2 months ago | 3 downloads |

how to prompt user to try again instead of letting MATLAB display "Index in position 1 exceeds array bounds" error message.
a= [1 2 3; 4 5 6; 7 8 9]; askAgain = true; while askAgain position = input ('input a number: '); if posit...

2 months ago | 0

| accepted

Errorbar on Box and Whisker Plot
If you want error bars on the same box plots, you can use something like this: tab = table(randi([1, 50], 20, 1), repmat([1; 2]...

2 months ago | 0

How to extract the data from webread output?
It's always better to first check the RESTful API documentations. In your case, you can get those values either by applying rege...

2 months ago | 1

| accepted

why Normal Distribution with Histogram not matching?
This is because histogram shows frequency of your sample, while PDF plots the density. Of course you can change the way histogra...

3 months ago | 0

how many times is a value repeated in a table
You can play with groupSummary which offers lots of options: tab = table(repmat([20; 50; 100], 20, 1), string((1:60).'), 'Varia...

3 months ago | 0

How to plot box plots of data of different sizes on the same figure?
You just need to define a grouping array: x1 = randn(128, 1); x2 = randn(100, 1); X = [x1; x2]; grp = [ones(size(x1)); 2.*o...

3 months ago | 0

| accepted

want to order and group files
You can try regexp or pattern: dcm = "00022.dcm"; bmp = ["2015220700022_Frame20.bmp", "2015220700023_Frame20.bmp", "2015220700...

3 months ago | 0

| accepted

Regression with tall array (Using datastore, CSV) - Error
Well, your data is tall table, and that's what MATLAB complains about: since your first argument is a table, MATLAB thinks y is ...

3 months ago | 0

| accepted

Is there a way to get a confidence/probability score on fitrsvm or other regression techniques like fitrensemble using the 'predict' function?
You already answered yourself! % MATLAB doc for fitrsvm load carsmall X = [Horsepower,Weight]; Y = MPG; Mdl = fitrsvm(X,Y)...

3 months ago | 0

How to adjust size of the legend in large figures?
Try NumColumns property: plot(randn(400, 40), randn(400, 40), '.-') legObj = legend(gca, 'NumColumns', 2);

3 months ago | 0

| accepted

Subsets of uncorrelated features
Let R be the pairwise correlation matrix: N = 10; R = rand(N); R(logical(eye(N))) = 1; for i = 1:size(R, 1) - 1 for...

3 months ago | 1

How can I assign different colors to different bins of a single "bar/barh object"?
Well, you just needed to go through the doc for bar. y = [75 91 105 123.5 131 150 179 203 226 249 281.5]; h = bar(y, 'FaceColo...

3 months ago | 2

| accepted

how to draw classification response of machine learning model ? (Ex. Logistic Regression Response)
You can plot predicted probabilities from a logisitc regression model: y = randi([0, 1], 1000, 1); x = randn(1000, 1); mdl ...

3 months ago | 0

How to allow for multiline input for inputdlg?
Have you tried new line? num_lines = 1; cues = {'lake', 'river', 'water', 'ocean', 'forest'}; index1 = randi([1,5]); answer ...

3 months ago | 0

Ignore NaN value when iterating
arrayfun(@(x)numel(A(x, ~isnan(A(x, :)))), 1:size(A,1)) 5 1 3

6 months ago | 0

| accepted

find probability of chi2 test
Based on what you explained it seems you already have the X2 stat. p = 1 - chi2cdf(x, nu) % where x is chi2 stat and nu is df

6 months ago | 0

| accepted

Ask for Data Extraction
t = readtable('text.txt'); t.Properties.VariableNames = "col" + (1:size(t, 2)); % set col names 12×3 table col1 col...

7 months ago | 1

How to change color of imported geometry from .mat file?
h = findobj(gca,'Type','Patch'); h.FaceColor = 'b'; % set it to blue or whatever

7 months ago | 1

| accepted

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(:,:...

7 months ago | 0

| accepted

Removing outliers using standard deviation
groupfilter does the trick cleanTable = groupfilter(yourTable, 'Hour', @(x)~isoutlier(x, 'mean'), 'Price');

7 months ago | 0

| accepted

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

8 months ago | 0

| accepted

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...

8 months ago | 0

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...

8 months ago | 1

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

8 months ago | 0

| accepted

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('...

8 months ago | 0

| accepted