Answered
How to reduce the code (csvread, reshape, concatenate matrix)?
I would do something like this. fileList = {'bend/daria_bend_geo01.csv','bend/daria_bend_geo01.csv',<etc>} numberFiles = num...

6 years ago | 1

| accepted

Answered
Could anyone help me how to five different mat files in workspace into a single mat file.
One possibility is user1 = load user1.mat user2 = load user2.mat user3 = load user3.mat user4 = load user4.mat user5 = load...

6 years ago | 0

Answered
Why normalize function has a different result on a matrix vs single value?
Your question perplexes me. In general, the scaling parameters for normalization can depend on every input value in the vector....

6 years ago | 0

Answered
Error using min. Matrix dimensions must agree.
You just need to be a bit more careful with the syntax. Take a look at the documentation. max(rand(4),[],'all') With the synta...

6 years ago | 0

| accepted

Answered
Changing the indices in kmeans clustering
There is a different solution, but it can only be applied after-the-fact, when you have seen how kmeans has assigned the cluster...

6 years ago | 0

Answered
Changing the indices in kmeans clustering
I am not certain how robust this solution will be, but I think one possibility is to input initial centroid guesses that are nea...

6 years ago | 0

Answered
Plot interval for inverse cos
Instead of the default value, increase the number of points used in linspace. For example, x=linspace(0,5*pi,1000)

6 years ago | 0

| accepted

Answered
How do I store the output
When you index into xt1, you are using ceil(end/3):ceil(end/3*2) and when you index into xhat, you are using ceil(end/3:end/3...

6 years ago | 1

| accepted

Answered
How do I change the class label of the confusion matrix?
According to the documentation: cm = confusionchart([1 3 5; 2 4 6; 11 7 3],{'apple','watermelon','pear'}); cm.Title = 'My Conf...

6 years ago | 3

| accepted

Answered
Saving nonempty columns of cell as separate variables with specific names in matfile
Dynamically named variables are almost always a terrible idea. See, for example, this explanation of many reasons why. Could y...

6 years ago | 0

Answered
For loop question help
You don't need a loop. output = A(x); gives you all the values at once. (Then you can loop over that if you need to)

6 years ago | 0

Answered
Finding the value of X which gives y=Value
You could interpolate piecewise. % Original data x=[1,2,3,4,5]; y=[1 2 2.5 2 1]; % Plot the data. Always plot the data! f...

6 years ago | 0

Answered
3-D matrix operations
Assuming that for the average of columns you want the result that Turlough specified, then RefBloAvg = movmean(RefBlock,[0 1],2...

6 years ago | 0

| accepted

Answered
find the mean for each category and summarize it
For a numeric array, you can use the accumarray function to do this. That function is a bit tricky to learn the power of, and is...

6 years ago | 0

| accepted

Answered
distace from kmeans cluster to Image center
As mentioned in the documentation for kmeans, if you call the function as [idx,C] = kmeans(); the output C gives the location ...

6 years ago | 0

| accepted

Answered
Using fminunc() for logistic regression
Is there a zero in x, such that the log is undefined?

6 years ago | 0

Answered
I want to plot a function for different values of time
f = @(x,t) (699729515992263*exp(-(3555899736243218994140625*t)/9007199254740992)*cos(20000000*pi*x))/144115188075855872 - (84784...

6 years ago | 1

| accepted

Answered
Automatically Run a Matlab Script
See this question & answer.

6 years ago | 0

Answered
2019b: How to force it start in 32 bits
The latest MATLAB version with 32-bit compatibility is 2015b. You can download it from this page.

6 years ago | 0

Answered
Deleating the 3rd dimension from a 3Dmatrix
You can remove both at once: a(:,:,[22 23]) = []; The main problem with your method is that after you remove the 22nd slice, t...

6 years ago | 0

| accepted

Answered
Mapping two matrix elements
I believe the closest MATLAB equivalent to python's dictionary is a map container.

6 years ago | 0

Answered
Change color of graph at a certain value (temperature vs. time)
One option would be to draw the data as points, perhaps with a thin black line to guide the eye to time-consecutive points. rng...

6 years ago | 0

Answered
What is the best practice of conditional statements in solving a complicatedly branched system?
An alternative would be to build up your expression via logical components of this form a = 2.0676; b = -0.2309; c = 4.342 ...

6 years ago | 1

Answered
How to use diag() once and change values after certain element?
A simple way to construct the exact matrix in your first part is matrix = 2*eye(4) + diag([-1 -1 -1],-1) + diag([1 1 1],1) How...

6 years ago | 0

| accepted

Answered
Behaviour of backslash operator for non-square matrices least-squares fitting
They are equal, to within floating-point precision. Notice that max(abs(c1(:)-c2(:))) is around 1e-16.

6 years ago | 1

| accepted

Answered
How to save each term from a sum
clear n = input('Number of terms: '); terms = zeros(n,1); for ni = 1:n terms(ni)=terms(ni) + (sum(1/(ni^2)...

6 years ago | 0

Answered
keep getting errors on matlab
Instead of writing sin(t)cos(t) you need to put the explicit operations in, like this sin(t)*cos(t)

6 years ago | 0

Answered
Showing : At least one END is missing: the statement may begin here.
The last line of rng.m is endfunction but it should be just end I also spotted another problem, which is that you should hav...

6 years ago | 1

Answered
Reshaping a 2 d matrix into a 3 d matrix row wise.
For your small example, if A is your original matrix, then permute(reshape(A',3,2,[]),[2 1 3]) For the larger one, permute(re...

6 years ago | 0

| accepted

Answered
Fit multiple data with one mathmatical model/function
I would restructure my data (see attached), and use the nlinfit function from the Machine Learning and Statistics Toolbox. This...

6 years ago | 0

| accepted

Load more