Answered
An UndefinedFunction error thrown by parfor but not for
Constants defined in scripts cannot be identified by the Matlab, when it parses the parfor block. In addition such scripts have ...

5 years ago | 3

| accepted

Answered
how to read multiple file from single .mat file
I assume you use the term "file", but you mean "variable". Calling load() without catching the output, creates variables dynami...

5 years ago | 1

| accepted

Answered
Could someone please explain what is wrong in my function?
function [Sign] = signum(A) The indices (r,c) belongs to the caller of the function, not inside the function. You call this fun...

5 years ago | 0

Answered
Text doesn't change in guide while i can see it change in the commande window
It is not the cause of your problems, but global variables are a shot in your knee. Avoid them consequently. Instead of searchin...

5 years ago | 1

| accepted

Answered
Error in sort function when grouping events
Use the debugger: dbstop if error Afterwards start your code again. When Matlab stops at the error, what is the contents of rp...

5 years ago | 0

Answered
How to combine matrices with different size but preserve elements with same value?
Do you mean union? A = [1; 5; 8; 9]; B = [1; 2; 4; 5; 7; 9]; C = union(A, B)

5 years ago | 0

| accepted

Answered
How to sum specific elements of a matrix
The most efficient solution is to ask in the forum, because this is faster than solving this problem by your own ;-) X = randi(...

5 years ago | 0

Answered
Calculating Integral using Array Input
You do need a loop to get the best solution. Remember that integral is an adaptive method, which creates finer grids until a cer...

5 years ago | 0

| accepted

Answered
I have P=[2 3 4 0 5 1 0 2 ]; and I want to create a loop to remove zeros from P and calculate C, description in the code
P = [2 0 4 0 5 1 2 0 ]; zeroIndex = find(P == 0); for k = 1:numel(zeroIndex) Q = P; Q(zeroIndex(k)) = []; ... Ins...

5 years ago | 0

| accepted

Answered
Solve first ode using ode45
You can modify the examples of the documentation easily, see: doc ode45 Temperature0 = 6.2; % Your initial value [Time...

5 years ago | 0

Answered
exit from a nested loop
"I correctly exit from the inner while loop but afterwards it does not increment i" Why do you assume this? The outer loop is n...

5 years ago | 1

| accepted

Answered
Group files with same names
Folder = 'D:\Your\Data\Folder'; FileList = dir(fullfile(Folder, '*.jpg')); FileName = {FileList.name}; Name = unqiue(st...

5 years ago | 0

Answered
"Access Elements of a Nonscalar Structure Array" issue
You cannot access fields of deeply nested structs in Matlab. You need a loop to do this.

5 years ago | 1

| accepted

Answered
How to use ODE45 to solve 2nd order differential equation with random variables in it?
dt = 0.01; tf = 30; tspan = dt:dt:tf; y0 = [0;100;0;10]; for k = 1:100 ms = 10 + randn; mu = 20 + randn * 2; ....

5 years ago | 0

| accepted

Answered
While loop and randomization
x = [1 1 1 2 2 2 3 3 3]; ready = false; while ~ready y1 = [x(randperm(numel(x))); x(randperm(numel(x))); x(randperm(nume...

5 years ago | 0

Answered
Evaluate function handle for each value in vectorized form
alpha = 1; n=10; rng default beta_all = randn(n, 1); gamma_all = randn(3, n); res = num2cell(alpha * beta_all.' .* gamma_...

5 years ago | 0

| accepted

Answered
Angle between two lines
This cannot work. There is no realtion between Theta and Phi. Therefore the parameters to define the blue line does not allow to...

5 years ago | 0

Answered
How to read multiple .spc files
Please read: https://www.mathworks.com/matlabcentral/answers/57446-faq-how-can-i-process-a-sequence-of-files

5 years ago | 0

| accepted

Answered
how to common string data in two string celland their indexes
[Both, indexPop, indexNames] = intersect(population, names) Here indexNames is not a cell, but a vector, which is more useful f...

5 years ago | 0

| accepted

Answered
How to populate a new variable from an old one
You are aware of the warning about creating variables dynamically. So why do you try to do this? This method is a shot in you kn...

5 years ago | 1

Answered
Unrecognized function or variable, some functions can be accessed, some not.
After inserting folders in Matlab's path, remember to refresh the toolbox cache: rehash toolbox % or permanently: rehash tool...

5 years ago | 0

Answered
Getting Nan after using expm
See the help text of expm: Although it is not computed this way, if A has a full set of eigenvectors V with corresponding eigen...

5 years ago | 0

| accepted

Answered
Trying to solve 3 simultaneous equations, results seem erroneous
syms x y z eqn1 = 109*x + 54*y + 124*z == 7.51; eqn2 = 57*x + 30*y +63*z == 3.17; eqn3 = 30*x + 17*y + 31*z == 1.24; sol = s...

5 years ago | 1

| accepted

Answered
how to import a saved figure into a subplot
You can create the subplots and copy the axes of the opened figures using copyobj.

5 years ago | 0

Answered
I need to combine all these measurements as you can see the scale is different for every measurement.
measurement = measurement - measurement(1)

5 years ago | 1

| accepted

Answered
Missing file error when installing
Please try to disable the virus protection software during the installation. There have been several related questions in the l...

5 years ago | 1

| accepted

Answered
Is there a way to modify default function template
See e.g. https://www.mathworks.com/matlabcentral/fileexchange/41624-newfile

5 years ago | 2

Answered
Grouping identical matrices in cell array
Start with a simplified version of your code: n = numel(a); groups = zeros(n, 1); counter = 0; for i = 1:n if gro...

5 years ago | 2

| accepted

Answered
Interpolate non-uniform signals
John D'Erricos warning is important: The data do not look like an interpolation is fair. But if you have a good reason to do thi...

5 years ago | 0

| accepted

Answered
Error in pack command
"My program command is pack temp.dat." What does this mean? The builtin pack command does not accpet any inputs. Therefore I gu...

5 years ago | 0

Load more