Answered
Predictions Logistic Regression model using fitglm
I have a couple of comments, before answering your specific questions. First, you might benefit by reading up a little bit on g...

1 month ago | 1

| accepted

Answered
Turning a char element in a double array
a = char('[21,12,43,1]'); array_convert = str2num(a)

1 month ago | 0

Answered
How to replace only one instance in a certain string
If you are certain that the first e is the first character of the string, then this will do it: x = 'e-8.5e-5' y = regexprep(x...

1 month ago | 0

| accepted

Answered
read data of 3 dimensional matrix
% Some pretend data data = rand(129, 135, 365); % Max along 3rd dimension max3 = max(data,[],3); % Display size of max3 ...

1 month ago | 0

| accepted

Answered
Is there any more efficient way to split a table than this
% Set random seed for reproducibility rng default % Make up a table with pretend data N = 30; x = rand(N,1); solar = 200*...

1 month ago | 0

| accepted

Answered
Plotting y1 and y2 versus time in the same graph with same axis level but both in the same side and different y axis name.
Not sure what you mean about "mentioning both speeds in y axis". A more conventional method would be to use a legned. Does this ...

1 month ago | 1

Answered
How to create animation of multiple of frames using for loop ?
I believe you can do what you want by using the getframe and movie functions.

1 month ago | 0

| accepted

Answered
Remake this without a loop
% Pretend data A = 1 : 7; vector = [2 3 5]; % Replace values of A with 0, if they are in vector A(ismember(A,vector)) = 0

1 month ago | 1

| accepted

Answered
I have been working on this code. But it's kept showing me this error. Please help me
How are you trying to run that code? If you just try to run those lines from the Command Window, it will give that error. The r...

1 month ago | 0

Answered
Get next business day without taking into account holidays and saturdays
The issue is not a problem with busdate(), but with your understanding of the input. 20170610 is being interpreted as a serial d...

1 month ago | 1

| accepted

Answered
Using a GLM model to predict the response factor from a fixed factor
I'm very confused about how you have coded the model. Specifically, The first input to fitglm should be the predictor variable,...

1 month ago | 0

| accepted

Answered
Turning an entire script into a function
Put this code into a file named battleship.m function [] = battleship() clear all close all clc rowdim=input('give me...

1 month ago | 0

Answered
kstest for uniform distribution
From the documentation: "The one-sample Kolmogorov-Smirnov test is only valid for continuous cumulative distribution functions."...

2 months ago | 0

Answered
Using Linear Mixed Models with two fixed factors and a random factor
You can fit such a model using the fitlme function from the Statistics and Machine Learning Toolbox. I think the following code...

2 months ago | 1

| accepted

Answered
How to find area under curve
I did not open your text file, but assuming you got that plot using plot(x,y) then it should be as easy as trapz(x,y)

2 months ago | 0

| accepted

Answered
How to bin IDX based on previous IDX value?
Is this what you mean? a = [0 0 1 2 2 1 2 2 1 0 1 0 2]; loc2 = a(2:end)==2; pre = a(1:end-1); b = 1 + find(loc2 & (pre=...

2 months ago | 0

Answered
how do we make vector the same length ( i get the error: vector must be the same length)
I think you intended elementwise division. See the documentation for array vs. matrix operations. x=linspace(0,100); y=linspac...

2 months ago | 0

Answered
I have this code in matlab but it does not work alone. I think I need a script for it.
Works for me. Here is an example f = @(x) x.^2 - 1; df = @(x) 2*x; Newton_method(f,df,3,1.e-6,500) function x = Newton_...

2 months ago | 0

Answered
How to plot the figure in the while loop ?
Try putting the figure command and the hold on commands before the while loop (and put the figure command before the hold on). ...

2 months ago | 0

Answered
How to create a matrix using two arrays (x & y) and a formula that uses x & y
Use the meshgrid function to create 2-dimensional grids from the x and y vectors. The first example in the documentation is very...

2 months ago | 1

Answered
How do I show this matrix in Matlab?
N = 5; % Change this to 50000 for your case a = 3; % The diagonal value b = -1; % The off-diagonal value % Create the matr...

2 months ago | 0

Answered
Trying to multiply these matrices and getting error "Dimensions of arrays being concatenated are not consistent."
vqs_ is a 1x501 vector. You can't concatenate the scalar vds to it vertically, which is what you are trying to do.

2 months ago | 1

Answered
Generate random errors for data with specific covariance matrices
If you have the Statistics and Machine Learning Toolbox, you can generate correlated normal variables with the mvnrnd function.

2 months ago | 0

Answered
how to give title of the legends?
You can use the legend function.

2 months ago | 0

| accepted

Answered
How to create matrix with Standard deviation from every 5 columns of another matrix?
Here is one way: % Pretend data [Use your actual data instead] M = randn(100,20); % Reshape into the slices needed for stan...

2 months ago | 0

| accepted

Answered
Using Histogram to create a figure with multiple data sets
One possibility would be to use histcounts to get the bin counts (instead of histogram to plot the bins directly), and then a st...

2 months ago | 0

Answered
How to update array inside a database
I don't fully know the answer, but here are a couple thoughts. I highly doubt you need to explore JDBC. If ODBC works for fetch...

2 months ago | 0

Answered
Cost matrix from an array without for loop.
You can use implicit expansion to subtract the two vector from each other, by transposing one of them. cost = abs(domain-domain...

2 months ago | 1

| accepted

Answered
Is there a way to avoid this inaccuracy when converting an string to a double and then to an unsigned int? I have tried using str2num() but get the same result.Thanks!
The reason for this is that MATLAB uses double-precision arithmetic by default, which will typically give approximately 15 decim...

2 months ago | 0

Answered
Extract data from matrices and arrays using vectors of coordinates
Use the sub2ind function to convert the subscripts to a linear index into the matrix. Using your example: A = [1 2 3; 3 4 5; 8...

2 months ago | 1

| accepted

Load more