Answered
how to sum cell elements in a dynamic cell table
Maybe: A = num2cell([1:6; 2:2:12; 3:3:18]); % Some test input S = size(A); % Size of the input ini = ones(1, S...

7 days ago | 0

| accepted

Answered
why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++
Not an answer, but an improvement of the Matlab code, which run in 10.7 sec on my R2018b i5m instead of 13.0 sec of the original...

9 days ago | 1

Answered
Hi every body, I write this code and I want to find a new Sol and Soll in iteration 1000 or more but the problem that the answer go to Nan?!
Use the debugger to find the iteration, which causes the NaNs: dbstop if naninf Then Matlab stops, when the first NaN occurs. ...

9 days ago | 0

Answered
Why is saveas() changing my image aspect ratio?
Try to set the 'PaperSize' property of the figure.

9 days ago | 0

Answered
precision of double variables
Welcome to the world of numerics with limited precision. These are the expected effects. You observe the value mentioned in the...

9 days ago | 0

Answered
Summation of every nth column
S = size(LoadProfile); X = reshape(LoadProfile, S(1), 4, S(2) / 4); X = reshape(sum(X, 2), S(1), S(2) / 4).'; Result = X(:);

9 days ago | 0

Answered
Why am I getting the error "not enough input arguments"?
The function handle provided to fminsearch must accept 1 input argument. fminsearch cannot guess, that H0 should be provided als...

9 days ago | 0

Answered
Log Error and Warning Messages to Text File
You can catch errors using try-catch and write the messages whereever you want. Redirecting warnings is more tricky. I use my o...

9 days ago | 0

Answered
All tables being vertically concatenated must have the same number of variables.
I assume you want an "outer-join": https://www.mathworks.com/help/matlab/ref/outerjoin.html Output = table(); for kk = 1:nume...

9 days ago | 0

Answered
Integration approximation with function handle
f = @(a,b,h,f0) ((a+(n-1)*h+a+n*h)/2)*f0; This cannot work if f0 is a function handle. This is at least confusing: for n=1:n ...

9 days ago | 0

Answered
why do I get -Inf
alpha = 0.5; u0 = 0; a_k = @(k) (k + 1)^(1 - alpha) - (k)^(1 - alpha); n = 100; a = 0; b = 1; h = (b...

10 days ago | 1

| accepted

Answered
generate an independent seed with a fixed number
rng('default') is the default seed at the start of the Matlab session. All subsequent requesrts of random numbers move the see...

10 days ago | 0

Answered
imshow is not working
You have created a script called "image.m". This shadows the built-in function image. Shadowing built-in functions is a serious...

10 days ago | 0

Answered
Can parfor be used in this context?
"Can I use parfor in a context where the second iteration depends on the results of the first iteration." No, you can't for obv...

10 days ago | 0

| accepted

Answered
cell arrays not explicited
A = answer; % Why? You do this again here: for j = 1:numel(answer) % NUMEL is safer than LENGTH A{j} = answer{1,j}; ...

10 days ago | 0

Answered
How to label coins after recognizing them?
rgb = insertText(I,[prop.Centroid(i,1) prop.Centroid(i,2)],'5kr', ... 'FontSize',48,'TextColor','black'); This inserts the...

10 days ago | 0

| accepted

Answered
Unable to open file You might not have write permission.
Does the file exist already? Is it opened by another process already? Can you delete in manually? Can you create a new file in t...

11 days ago | 0

Answered
Not enough input arguments.
Do not provide parameters as appended variables in the ODE45 call: % In lya: [T,Y] = ode45(rhs_ext_fcn,[t t+stept],x,R); % ...

12 days ago | 0

Answered
simplify function does not work properly
syms kd z mean_t mean_t2 p assume(assumptions(),'clear'); eq = 8*kd^2*p^2*z*(mean_t - kd*mean_t2)^2 * ... (- mean_t^2 + m...

12 days ago | 0

Answered
export .txt file
M = [ 4.12449 0.37223 0.89067 0.00000 0.00000 11492.2 1.000 1 17214 0.103]; [fid, msg] = fopen('answer.txt...

12 days ago | 0

| accepted

Answered
Installing a external toolbox to a matlab path.
"Path" means the list of folders stored in the function path. See: path . Create a folder onyour disk and use either pathtool t...

13 days ago | 0

Answered
I had an error when İ run the code
The error message is clear already: Functions can only be created as local or nested functions in code files. So where did ...

13 days ago | 0

Answered
rng('default') unreliable
rng('default') sets the random number generator to the initial state. This is a reliable procedure. If your code replies differ...

13 days ago | 0

Answered
How to create Plot button for Complex vector?
As far as I understand, all you need is to create a folder on your local disk and add it to Matlab's PATH: addpath('D:\MyMFiles...

13 days ago | 0

| accepted

Answered
For loop to make an array from workspace variables
"the variables are named something like: Object_01_number_01_Right" This is the core of the actual problem. Hiding data in the ...

13 days ago | 2

Answered
Semi colons aren't suppressing output
The problemis here: cmd =sprintf('t%s=cell2table(G(isec(%d)+5:isec(%d)-2,:));', SECTIONS{i}, i, i+1); % ...

13 days ago | 2

Answered
Indexing a range of a 3d matrix incredibly slow?
If you post the relevant part of the code and some matching input data, it is very likely, that this forum can provide some impr...

13 days ago | 0

Answered
How can I extract a field from a matrix of structs, preserving the shape of the matrix?
for i1 = 1:3 for i2 = 1:4 S(i1, i2).A = 10*i1 + i2; S(i1, i2).B = 10*i1 + i2 + 1000; end end A =...

13 days ago | 0

| accepted

Answered
How to pad NaNs in a matrix having small size to make equivalent with matrix of large size?
A = [1 2 3; 4 5 6; 7 8 9]; B = [1 2; 3 4]; C = padarray(B, max(0, size(A) - size(B)), NaN, 'post')

14 days ago | 0

Answered
Saving multiple texts to an array
You have solved storing the set of areas using: area(i) . To store the set of CHAR vectors in a cell array, use: rt{i} . If you...

14 days ago | 0

Load more