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...

9 jours 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...

9 jours 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...

9 jours 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...

11 jours 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...

11 jours 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.

11 jours 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; ....

12 jours 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...

12 jours 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_...

16 jours 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...

16 jours 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

17 jours 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...

17 jours ago | 0

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...

17 jours 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...

17 jours 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...

17 jours 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...

17 jours 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.

18 jours 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)

18 jours 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...

18 jours ago | 1

| accepted

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

18 jours ago | 1

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...

18 jours 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...

18 jours ago | 0

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...

18 jours ago | 0

Answered
single precision mode and difference between Matlab and cortex-m
This is the expected behaviour. There is not exact representation of 0.06 in IEEE 754 32 bit floating point numbers, neither in...

18 jours ago | 1

| accepted

Answered
Reading Text file from IMC company
From a certain byte in the text the contents is not plain ASCII anymore. I guess boldly, that this was a problem wuring writing ...

18 jours ago | 0

Answered
How can reduce code?
I'd stay at the loop and only avoid repeated indexing: for k = 1:length(ind_cond) kk = ind_cond(k); S.Fecha ...

18 jours ago | 0

| accepted

Answered
using area function - drawing below 0 of y axes
This sounds like a job for a patch: figure; axes('XLim', [0, 10], 'Ylim', [-5, 5]); patch([1,2,2,1], [-3,-3, 4,4], rand(1,3))...

18 jours ago | 0

Answered
MATLAB 2020b crashing without error messages
If the code contains some C-mex functions, they can corrupt the memory. With some luck, Matlab can still work until a random fol...

18 jours ago | 0

Answered
How do I subtract number from Cell?
Dice1=[1/7 1/7 1/7 1/7 1/7 2/7]; Dice2=[1/7 1/7 2/7 1/7 1/7 1/7]; ind = abs((1:length(Dice1)) - (1:length(Dice2)).') + 1; val...

19 jours ago | 0

| accepted

Answered
how to set answering time window that awaits specific keypresses as response in MATLAB 2011b?
% [TESTED in R2009a] function test FigH = figure('KeyPressFcn', @KeyPressed); TimerH = timer('TimerFcn', @(TimerH, EventD...

19 jours ago | 0

| accepted

Load more