Answered
Aggregate data every 10 seconds
This syntax of retime looks like the applicable one, TT2 = retime(TT1,'regular',method,'TimeStep',dt)

3 years ago | 0

| accepted

Answered
Can't plot contour graph on a different plane
figure(2) iy =1; contourf(squeeze(x_mesh(:,iy,:)),squeeze(z_mesh(:,iy,:)),squeeze(g(:,iy,:))) title('x^\prime z^\prime plane'...

3 years ago | 0

| accepted

Answered
how to solve diagonal matrix of each page of a 3D vector ? pagediag?
A=rand(1,4,3) [~,n,p]=size(A); B=zeros(n^2,p); B(1:n+1:end,:)=reshape(A,n,p); B=reshape(B,n,n,p)

3 years ago | 0

Answered
Radon Transform works unexpectedly
Instead of radon(), you could use one of the parallel beam forward projectors (the SIddon algorithm is probably best) from the T...

3 years ago | 2

| accepted

Answered
Split data into groups without applying a function
G=findgroups(Gender); groupedHeight=splitapply(@(x){x}, Height,G)

3 years ago | 0

| accepted

Answered
The best approach to avoid the Kullback–Leibler divergence equal to infinite
% Input A =[ 0.444643925792938 0.258402203856749 0.224416517055655 0.309641873278237 0.0...

3 years ago | 1

| accepted

Answered
Identify the point where three lines are meeting, thus making a Y section.
Use delaunay to form the delaunay triangulation and then freeBoundary to find which vertices are on the boundary. The vertices t...

3 years ago | 0

Answered
Computing variance of a variable after linear fit using lsqcurvefit function
It would be, yvariance = [1,x0]*ACovariance*[1;x0]

3 years ago | 0

Answered
Solving Matrix Equations With Unknown at Both Sides
T1=optimvar('T1'); T2=optimvar('T2'); F2=optimvar('F2'); prob=eqnproblem; prob.Equations.eqn=[1 -0.5 4;-0.5 2 0; 4 0 3]*[T...

3 years ago | 0

Answered
Solving Matrix Equations With Unknown at Both Sides
Since these are linear equations, you would re-arrange in the form Matrix*[T1;T3;F2] =[4; 0; 5] and solve normally.

3 years ago | 0

Answered
How to divide a 400x800 matrix to 8x8 blocks?
Processing is usually faster if you keep the data in numeric form. Using this FEX download, https://www.mathworks.com/matlabce...

3 years ago | 0

Answered
How to divide a 400x800 matrix to 8x8 blocks?
Easier to use mat2tiles from this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/35085-mat2tiles-divide-ar...

3 years ago | 0

Answered
I have a matrix. I want to count number of only those zeros which are lying between 2 sets of consecutive nonzero values on each side. How to do? Desired result given below
Using this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutive-repetition...

3 years ago | 0

Answered
delete special characters (\ / : * " < > |) in char
One way: name_1 = '<Hello World>'; pat=num2cell('\/:*"<>|'); name_1=erase(name_1,pat)

3 years ago | 0

| accepted

Answered
delete special characters (\ / : * " < > |) in char
One way: name_1 = '<Hello World>'; tf=ismember(name_1, '\/:*"<>|'); name_1(tf)=''

3 years ago | 1

Answered
Change a repeated number with the times the number is repeated in an array.
yourCell={[8.1,2.7,8.1,8.1,2.7]; [6.3 6.3,4,5,6.3]} result = cellfun(@fun, yourCell,'un',0) function y=fun(x) ...

3 years ago | 0

| accepted

Answered
I cannot run the "fmincon" solver.
error = norm(T_gas_outlet_est - T_gas_outlet).^2;

3 years ago | 0

Answered
array of anonymous function
clear obj for k=3:-1:1 obj{k} = @(V) I_fun(V, I0, IL, Rs, Rp, Vt_Ta) - target_value; fplot(obj{k},[0 55],'LineWidth',...

3 years ago | 0

| accepted

Answered
delete columns inside a cell based on null elements
map = cellfun('isempty',union_cell) tf=all( map(3:5,:),1); union_cell(:,tf)=[]

3 years ago | 0

| accepted

Answered
An alternative for strlength function for MATLAB 2013
There were no string data types back then, only char vectors, so you could just use length() or numel().

3 years ago | 1

| accepted

Answered
How can I solve this problem? "Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.375012e-18"
I believe the error originates from avec = Mm\b If so, it is because the Mm matrix is singular. The solution would be to make i...

3 years ago | 0

Answered
How can I record data from a parfor loop into an array?
Why is this not possible From the documentation for sliced variables (which array is supposed to be in this case): Form of Ind...

3 years ago | 1

| accepted

Answered
Alphashape boundary detection not working as desired
Try bwlalphaclose() from this FEX submission, https://www.mathworks.com/matlabcentral/fileexchange/90762-further-tools-for-ana...

3 years ago | 0

Answered
Getting Not Enough Input Arguments error
My guess is that strcmp(AttributeIndex,ESIDString) is returning false and therefore no arguments are being given as input to cel...

3 years ago | 0

Answered
unpack cell array of letters to be plugged into individual-cell rows, in a vector
load infon2 c=infon2(:,end); L=max(cellfun(@numel,c)); for i=1:numel(c) c{i}(end+1:L)=""; end c=num2cell(vertcat...

3 years ago | 0

| accepted

Answered
surface fitting using a self-defined function
Your model function is not supposed to assume that the xy samples are drawn from a Cartesian grid lattice. ft = fittype(@(a,b,c...

3 years ago | 0

| accepted

Answered
Operator '+' is not supported for operands of type 'function_handle'.
It's a bad idea (i.e. very inefficient) to add two functions together, however, the proper way would be as follows: g=@(x)x+1; ...

3 years ago | 0

Answered
Error while converting polyshape into double
You have pre-allocated ShipImg as a numeric double float vector, ShipImg = ones(1,length(t)); %a double vector of ones Then i...

3 years ago | 0

| accepted

Answered
How to find the indices of minimum value in a 4D matrix?
[lowestValue,locmin]=min(A(:)) [i,j,k,l]=ind2sub(size(A), locmin); %indices of min

3 years ago | 0

| accepted

Answered
I have curve fitting in matlab. My graph were all good when not add scatter in the graph. However, when i add scatter coding, the graph were not remain it origin.
It's hard to compare the two plots, because the x- and y-axes ranges are different in each. I suspect if you made the ranges the...

3 years ago | 0

Load more