Answered
Vectorize the code by selecting only a few rows in a matrix
Start with a pre-allocation: Do not let arrays grow iteratively. Even the editor warns you to avoid this. If you do pre-allocate...

9 years ago | 0

Answered
Subscripted assignment dimension mismatch.
If the code from the FileExchange fails, asking the author is a good point to start from. Another idea is to use the debugger by...

9 years ago | 0

Answered
manually creating my own audio file
The code can be simplified: function x = thehardway(y) x = repmat(0.0001221, size(y)); x(2:2:end, :) = -x(2:2:end, ...

9 years ago | 0

Answered
MATLAB no longer able to save files
Your virus scanner can block the access to the Documents folder to impede crypto locker, e.g. BitDefender does this. So check if...

9 years ago | 2

| accepted

Answered
How to read complex numbers from file and save them as type complex double
Store numerical data in text files is not efficient. The binary format would be better here. fid = fopen(FileName, 'r'); ...

9 years ago | 0

Answered
Why do I get "The parameter is incorrect" error when I launch Matlab 2017 (a or b).
What exactly does "ie: GUI; no command line parameters" mean? Did it work before or did this behavior start directly after the i...

9 years ago | 0

Answered
Why do I get:"Undefined function or variable 'pathtool'."
Something went wrong. If even the built-in |pathtool| cannot be found, the installation of R2017b failed. A re-installation is t...

9 years ago | 11

Answered
How can I reactivate MATLAB on an offline machine after upgrading from Windows 7 to Windows 10?
I expect that the old license file will work without modifications. But you could de-activate the license and re-activate it on ...

9 years ago | 1

Answered
How to write matrix elements with its position?
What about loops? A = [1 2 3; 4 5 6; 7 8 9]; [s1, s2] = size(A); for i1 = 1:s1 for i2 = 1:s2 fprintf('%d%...

9 years ago | 1

Answered
How to combine two matrices in the form of ordered pairs?
With [(1,1) (2,2) (3,3);(2,3) (3,1) (1,2);(3,1) (1,3) (2,2)] you introduce a notation without defining it. There is no s...

9 years ago | 2

Answered
How do I draw a colour bar with known discrete RGB values and known percentage of pixels represent each RGB values?
As pixel image: Map = [24 70 187; 208 118 22; 88 90 28] / 255; Ind = repmat(repelem([1, 2, 3], [50, 30, 20]), 40, 1); ...

9 years ago | 0

| accepted

Answered
how to implement one time pad encryption for images?
Your problem does not concern Matlab, but US laws about exporting information which is considered to be relevant for warfare and...

9 years ago | 0

Answered
num2str for strict string lengths
The real problem is importing text files with a fixed width for numbers. This is such an idiotic format! Even if you get this ma...

9 years ago | 0

Answered
uisetcolor dialog box may appears partially outside the screen. How to fix this?
Not a direct solution of your problem, but maybe it helps to use one of the alternative color choosers: <https://undocumentedmat...

9 years ago | 0

Answered
Improving speed in while loop
I'd change the |fopen('wt')| to |fopen('W')| (upper-case W for buffering), but I do not assume that this changes the runtime rem...

9 years ago | 1

| accepted

Answered
Why is my modified path not saved in MATLAB when I only have one pathdef.m?
The files inside |C:\Program Files (x86)\MATLAB\R2015b\| required admin privileges for writing. If you want to modify |<matlabr...

9 years ago | 0

Answered
Query regarding reshape and my code
Although you did not post the part of the error message, which mentions, what the error is, I guess that data2d = reshape(...

9 years ago | 0

Answered
Trying to integrate a function, but gives me an error
Using a standard function instead of an anonymous one, would allow for debugging. As soon as you share the relevant part of the ...

9 years ago | 0

Answered
Vectorized array operation which depends on previous array value
Do you have a C compiler installed? Then a C-mex would be the best option. // File: YourFcn.c #include "mex.h" void m...

9 years ago | 0

| accepted

Answered
How to 1 or more file i can run in my code?
Name = { 'Mert', 'Jack' , 'Jimmy' , 'John' }; Surname = { 'Dogan', 'Surname' , 'Surname' , 'Surname'}; Pattern = { 'H...

9 years ago | 1

| accepted

Answered
iterative method for matrix inversion
Start with applying an auto-indentation: Ctrl-A Ctrl-I. This improves the readability. k = 1 for i = 1:m zk = z(:...

9 years ago | 0

Answered
how to created and get data for use several action in pushbutton GUI?
You have 2 "a_input_Callback" in your posted code. You can use the same callback with different input arguments, if you want ...

9 years ago | 0

Answered
Toolbox and Add-on path not found in path
If |planetEphemeris| is an M-file, you can examine the line around line 160 to find out, where this function looks for the file,...

9 years ago | 0

Answered
XOR operation of double values?
James' comment is very useful. Currently answering requires too much guessing to be efficient. But I try it: |xor| works on v...

9 years ago | 0

Answered
Subscript indices must either be real positive integers or logicals?
A bold guess: You have redefined one of the used symbols "imread" or "psnr" by an array. Check this: which imread -all w...

9 years ago | 0

Answered
How to solve the 'Index exceeds number of subplots' error?
If you ask subplot to draw an 11th subplot on a 5 x 2 grid, you cannot expect that it is such smart to create a new figure and r...

9 years ago | 3

| accepted

Answered
to make a scaler from a vector
vec = [2 8 7]; num = vec * 10 .^ (length(vec)-1:-1:0).'; In your case this is [2, 8, 7] * [100; 10; 1] This work...

9 years ago | 0

Answered
Possibility of decompiling .exe to m files?
No, this does not work. The executable contain some parts of the M-files, e.g. the comments, under certain conditions. But the a...

9 years ago | 0

Answered
How can I delete numeric Headings/Delimiters from a large text file
inFID = fopen(FileName, 'r'); outFID = fopen([FileName, '.fixed'], 'W'); % [EDITED: 'w' => 'W'] Delimiter = ',';...

9 years ago | 1

| accepted

Answered
Can you help me please to solve this problem ??
Loss of precision: convert double 32-bit to float 32-bit This is a strange message: There are no 32-bit doubles in Matlab ...

9 years ago | 0

Load more