Answered
Why do I receive this error message?
The message seems to be clear already. Some graphic output let the graphics driver crash. Follow the instructions given in the m...

5 years ago | 0

Answered
How to create a struct
str_rock = sprintfc('ROCK%d', rock_code); % Undocumented ROCK = cell2struct(str_rock(:), sub_rock(:));

5 years ago | 0

Answered
I am getting Index exceeds the number of array elements(1) error?
With guessing where the error occurs: dv_dt_p = -v(j)*dv_dx-(1/gamma)*((dt_dx)+(t(j)/rho(j))*drho_dx); dt_dt_p = -v(j)...

5 years ago | 1

Answered
How to speed up my code?
if ismember(selectedBus, InjBus_moreZeroLines) ismember replies a vector, if the inputs are vectors. The if command requires a ...

5 years ago | 0

| accepted

Answered
Error loading matlabprefs.mat
If removing the file helps for some time, a function is destroying the file. Then an approach is to scan, who is accessi ng the ...

5 years ago | 0

| accepted

Answered
Can I put an fprint statement in a saveas command?
folder = 'D:\Your\Output'; n = 4; saveas(FigH, fullfile(folder, sprintf('File%03d.eps', n))); This creates the file: D:\...

5 years ago | 0

Answered
How to extact bits from an image to a string separated with commas?
Your code produces a CHAR vector (a "string" is a different class). Now you explain, that there is an error, when you "try to op...

5 years ago | 0

Answered
How to sum over indices i+j=k without using a for loop?
Because beta is determined inside the for i and for j loops, we can improve only the inner loops: r = 501; kmax = 501; p ...

5 years ago | 0

| accepted

Answered
Rotate 3D matrix
X = rand(2, 3, 4); Y1 = permute(X, [3,1,2]); size(Y1) Y2 = permute(X, [3,2,1]); size(Y2) By the way, "matrix" means 2D by ...

5 years ago | 0

Answered
How do I get execute while else loop?
The == operator compares its arguments elementwise. This works only if one of the array is a scalar or if bother have the same s...

5 years ago | 0

Answered
Array Exponentials without For Loop?
A = [1 2 3]; B = [2 3]; C = A .^ (B.')

5 years ago | 1

| accepted

Answered
Safely interrupt a script/function
You can open a small window, which contains a stop button. Pressing this button sets a local variable, which can be checked from...

5 years ago | 0

Answered
Open image in Gui from menu
Unrecognized property 'XLim' for class 'matlab.graphics.primitive.Image'. XLim belongs to the axes. In the line: handles.Image...

5 years ago | 0

Answered
How to operate properly with multidimensional matrices and cells.
"For the other two, however, it goes wrong:" No, nothing goes wrong. This is exactly what is expected and needed. Only the dis...

5 years ago | 0

| accepted

Answered
Help needed in solving a matrix equation
A= [0,1;1,1]; B= [0,1;1,1]; Q= [2,0;0,4]; R= [0.5,0;0,0.25]; syms p11 p12 p21 p22 P = [p11, p12; p21, p22]; eqn = P * A + ...

5 years ago | 1

Answered
I dont know what to do
Remove the semicolons from these lines: x; y1; y2; y3; y4; The trailing semicolon suppresses the output. Therefore "x;" sh...

5 years ago | 1

Answered
FiltFilt function giving NaN values
I try to run your code guessing some inputs: srate = 1000; [b, a] = ellip(14, 5, 30, 2*(170/srate), 'low'); lpfSig = filtfil...

5 years ago | 0

Answered
How to insert data with fopen ?
fmt = [repmat('%.2f ', 1, 32). '\n']; ftempd = fopen('tempd.r2c', 'w'); fprintf(ftempd, fmt, tempd.'); fclose(ftempd);

5 years ago | 0

Answered
Run into "Paused: Press any key"
This problem appeared in R2016a already: https://www.mathworks.com/matlabcentral/answers/278430-why-does-program-execution-hang-...

5 years ago | 0

Answered
Formating all values of a structure field
No, you cannot access nested fields of a struct array in Matlab directly. You need a loop.

5 years ago | 0

| accepted

Answered
Cheat for preallocation requirement
x = []; for i = 1:1e5 x(end+1, :) = 1:10; end Here you allocate sum(1:1e5) * 10 * 8 bytes: 400 GB. c = {}; for i=1:1e5...

5 years ago | 0

Answered
the user will be asked to input number which is good but the problem is how can I make that as numbers and letters for example 2x and put it in matrix
This is a really complicated task, which is prone to bugs. How do you want to treat "2x" compared to "x2"? If "x" is a variable,...

5 years ago | 0

Answered
Subtract 1 from variable each second
counter = 100; TimerH = timer('TimerFcn', @doCount, 'ExecutionMode', 'fixedRate', ... 'Period', 1.0, 'UserData', counter...

5 years ago | 0

| accepted

Answered
Copy Multiple figures to the clipboard
The OS has a single clipboard only. There are some 3rd party apps, which offer more bins in the clipboard, but it is not easy to...

5 years ago | 0

Answered
How do I store the values of a for loop in a matrix array?
One solution might be indexing the output ... mat(u, u0, v, v0) = delta2(u, u0, v, v0); ... But this can be simplifi...

5 years ago | 0

Answered
Recover Corrupt Matlab File
What do you call "Matlab files"? which file extension do they have? M, P, MAT, MLX, ...? Based on the information "random chara...

5 years ago | 0

| accepted

Answered
Concatenating multiple cells in a single matrix
The conversion from numeric to string and back to numeric is an expensive indirection. n = 8; % p = uint64(2).^(0:n-1); % LSB...

5 years ago | 0

| accepted

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

Load more