Answered
How to select or group sections of an array without using indexing
>> A = [NaN, NaN, NaN, NaN, 2, 3, 6, 7, NaN, NaN, NaN, NaN, NaN, 4, 6, 8, 8, NaN, NaN, NaN, NaN]; >> X = diff([true,isnan(A),tr...

5 years ago | 0

| accepted

Answered
Assign values of .mat files into matrix
D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'silomodresults*.mat')); C = {}; for k = 1:numel(S) ...

5 years ago | 0

| accepted

Answered
Splitting an array up
Just use mat2cell, no need for reshape: >> M = rand(64,92690); % fake data >> N = 2048; >> S = size(M); >> V = repmat(N,1,fi...

5 years ago | 2

Answered
Subtraction inside a cell array
You will have to get the numeric data out of the cell array before performing any numeric operations on it. Although you did no...

5 years ago | 0

Answered
How to combine the multiple .mat files of ecg to get a single file.
This should get you started: D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'*.mat')); for k = 1:nume...

5 years ago | 1

| accepted

Answered
How to apply if statement in ode45 function?
c = max(0,c);

5 years ago | 0

Answered
Plot function with varying variable
The MATLAB approach is to use logical indexing, e.g.: z = 0:0.1:5; y = 2; f = z*y; idx = z>1; % logical index f(idx) = 2*z(...

5 years ago | 0

Answered
Sorting of points in 2D
Here is some simple code that that works quite nicely for your aerofoil. The code assumes that the top and bottom are both funct...

5 years ago | 1

| accepted

Answered
Why MATLAB asks for "more input arguments" in the function which is to be handled by ode45?
"However, exactly this is the syntax in the MATLAB documentation" I very much doubt that the MATLAB documentation shows any rec...

5 years ago | 0

| accepted

Answered
How to only replot part of a graph?
"Is there a way to only replot the changed point and the curve around it," Yes: you just need to change the XData and YData val...

5 years ago | 0

Answered
floating point arithmetics, mathlab's interpretation of a . after a number
"Why doesn't e yield 0?" Because most of your values cannot be exactly represented using binary floating point numbers. The va...

5 years ago | 1

| accepted

Answered
How to create arrays from repeated matrix raws?
>> A = [1,2,3,4,5;1,2,8,9,10;1,2,13,14,15;11,12,16,27,18;11,12,19,29,21;11,12,22,23,24] A = 1 2 3 4 5 1 ...

5 years ago | 1

| accepted

Answered
Automatically Update Plots on GUI With Multiple Sliders
One simple approach is to have one "update" function in your GUI and call it from each individual callback: function slider1Cal...

5 years ago | 2

| accepted

Answered
Sort() function return wrong values
You are not assigning the sorted matrix to anything. You need to assign it to a variable, e.g.: minCell = minCell(s, :);

5 years ago | 0

| accepted

Answered
Find index of element closest to other index
>> B1 = [0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1] B1 = 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 >> B2 = [1,1,...

5 years ago | 0

| accepted

Answered
How to read multiple image directory with for loop
Rather than fragile string concatenation and ungainly constructs involving int2str or num2str, the neat and efficient MATLAB app...

5 years ago | 1

Answered
how to get the memory address of variable in matlab
Undocumented feature, has been around for many versions: format debug Examples of its usage: https://www.mathworks.com/matlab...

5 years ago | 0

Answered
How to check if a element of a struct is empty?
fun = @(s) all(structfun(@isempty,s)); % check the fields of a scalar structure. idx = arrayfun(fun,Res_All_Meas); % indices of...

5 years ago | 0

Answered
How to rename an image after processing with different parameters
The cause of the problem is that your inner loop repeatedly processes the same string of the cell array Outputs. So you just kee...

5 years ago | 0

| accepted

Answered
how to calculate mean of submatrices in a large matrix and print out a new matrix
>> M = [11,12,13,14;21,22,23,24;31,32,33,34;41,42,43,44;51,52,53,54;61,62,63,64] M = 11 12 13 14 21 22 23 2...

5 years ago | 0

| accepted

Answered
How to effectively check a list of variables for existence and then check "isvector"
"The data are loaded from "mat" files, some may exist but some may not." Once those .mat files are already loaded directly into...

5 years ago | 0

Answered
Function is not working
The basic problem is that you keep repeating the same indexing, e.g.: resp = responses(targets==target); .. err = resp(target...

5 years ago | 0

Answered
Extracting Data to a workspace
The MATLAB approach: >> [X,Y] = meshgrid(0:3,0:2); >> A = X+Y; >> M = [X(:),Y(:),A(:)] M = 0 0 0 0 1 1 0...

5 years ago | 0

| accepted

Answered
Creating a Matrix from a nesting For loop
The MATLAB approach: >> [Xm,Ym] = meshgrid(1:25,1:25); >> Zm = Xm.*Ym; >> surf(Xm,Ym,Zm) Giving:

5 years ago | 0

| accepted

Answered
Problem with plotting vector fields
"also the figure I get comes out to be emtpy" You need to use array operations, not matrix operations: >> [X,Y] = meshgrid(2:1...

5 years ago | 0

| accepted

Answered
Passing Structure Array of Parameters into Boundary Condition Function for PDEPE
You need to parameterize the function: https://www.mathworks.com/help/matlab/math/parameterizing-functions.html Usually the si...

5 years ago | 0

| accepted

Answered
Not enough input arguments
There are two main bugs that we need to fix: define the correct function outputs. call the function with input and output argu...

5 years ago | 0

Answered
How to modify field any levels deep in a structure with a string
"i cant break the string into its fields and use something like app.(str1).(str2).str(3)..." You cannot use dynamic fieldnames ...

5 years ago | 0

| accepted

Answered
check if an array is equispaced
>> v = [1,2,3,4,5,6,7]; >> x = ~any(diff(v,2)) x = 1 >> v = [1,2,4,4.5,7]; >> x = ~any(diff(v,2)) x = 0

5 years ago | 1

Answered
Insert elements to cell array
g = g(:,[1,1:end]); g(:,1) = {M}

5 years ago | 0

| accepted

Load more