Answered
Anonymous function with variable number of input and output arguments
_"I need to use a different approach entirely?"_ Yes. Your basic approach is to magically access variable names or evaluat...

9 years ago | 2

Answered
\n Not Generating New Line In fprintf fid Command When Writing To .dat File
The simplest solution by far is to <https://www.mathworks.com/help/matlab/ref/fopen.html |fopen|> the file in text mode, simply ...

9 years ago | 1

Answered
how to display matrix in msg box
Use the correct tool: <https://www.mathworks.com/help/matlab/ref/uitable.html |uitable|> Or you might be able to change the t...

9 years ago | 0

| accepted

Answered
how to use a function that is not in the same folder as your current folder?
That is exactly what the MATLAB path is for: change the MATLAB path to include the folder where that file is saved. <https://...

9 years ago | 5

| accepted

Answered
How to load part of a big structure to the workspace?
Use <https://www.mathworks.com/help/matlab/ref/matfile.html |matfile|>, that is exactly what it was designed for.

9 years ago | 2

Answered
how to write lot of inputs in a function
_"how to write lot of inputs in a function"_ One robust answer: don't. Put all of the data into one structure, and then pa...

9 years ago | 0

| accepted

Answered
If loop: What's going wrong?
These are the relevant parts of the code: loopcount = 0; ... if TotalEnrolledNew < 10000; ... ... irrel...

9 years ago | 0

| accepted

Answered
How do i make this matrix simply
>> N = 5; >> X = reshape(repmat([0:2:N-1,1:2:N],2,1),[],2) X = 0 1 0 1 2 3 2 3 4 ...

9 years ago | 0

| accepted

Answered
how can i add row to matrix like
>> a = [1,0,3;3,4,5;7,5,2]; *method one: concatenation of submatrices:* >> b = [a(1,:);[0,1,2];a(2:3,:)] b = ...

9 years ago | 0

| accepted

Answered
Extraction of a sub matrix from a mother matrix
Download Matt Fig's excellent <https://www.mathworks.com/matlabcentral/fileexchange/28685-rcumsumc |rcumsum|> and simply do this...

9 years ago | 0

Answered
Extracting part of a string after the nth occurrence of a character
C = {... 'staticString1'';''staticString2'';''staticString3'';1;''nextString'';' 'staticString1'';''staticString2'';''st...

9 years ago | 0

| accepted

Answered
How do I change a value in my string matrix to 0.
Here is a much simpler and more robust solution based on <https://www.mathworks.com/help/matlab/ref/menu.html |menu|>: this has ...

9 years ago | 0

Answered
matrix as desired data using for loop
In just two lines (could easily be written in one line): >> A = [10,10,0.2,0,0;10,10,10,0.3,0;10,0.5,0,0,0]; >> fun = @(...

9 years ago | 1

| accepted

Answered
How to save and load complex variables and their values in Matlab?
Use <https://www.mathworks.com/help/matlab/ref/csvwrite.html |csvwrite|>.

9 years ago | 2

| accepted

Answered
how can i add row to matrix
>> a([1,3,2,3],:) ans = 0 2 3 7 8 9 1 1 1 7 8 9

9 years ago | 3

Answered
How do i use fzero to solve the following
That is not how to use <https://www.mathworks.com/help/matlab/ref/fzero.html |fzero|>. As its help clearly states and shows, the...

9 years ago | 0

| accepted

Answered
MATLAB functions str2double and strsplit taking long time
The approach of reading each line and then using |strsplit| and |str2double| will be slow, because those functions are inherentl...

9 years ago | 1

| accepted

Answered
I made a function, but the outcome isn't right
From my comment to the question: function [Q,W,E] = bolcoordinaten(Xnew,Ynew,r) A = 2*atan((abs(sqrt(Xnew.^2+Ynew.^2)))....

9 years ago | 0

Answered
How can I find the location of a substring in a char array
C = [... 'HRV: Beat 1 : First beat in block ' 'HRV: Beat 2; Interval 1 = 1034.93 ms (Normal)' 'HRV: Beat 3...

9 years ago | 1

| accepted

Answered
im getting an error in my code saying too many arguments
You define the function with one input argument: function [ L ] = get_laplacian( image ) and then try to call it with th...

9 years ago | 0

Answered
How to sort a matrix by row based on an index array
M(ib,:)

9 years ago | 0

Answered
Is this a bug in max(x)?
_"Is this a bug in max(x)?"_ There is no error with MAX. Floating point numbers cannot exactly represent those values, and yo...

9 years ago | 0

Answered
Is there a function to do this?
There is no need to manipulate the format string, it is much simpler to use the '*' option: >> sprintf('%0*d',4,12) ans ...

9 years ago | 2

Answered
can anyone help me to construct this matrix ?
You could use <https://www.mathworks.com/help/matlab/ref/toeplitz.html |toeplitz|>: >> W = 0:2:8 W = 0 2 4 6...

9 years ago | 1

| accepted

Answered
cumsum restarting at 0 column-wise
Download and use Matt Fig's excellent <https://www.mathworks.com/matlabcentral/fileexchange/28685-rcumsumc |rcumsum|>, which is ...

9 years ago | 2

Answered
how to generate the matrix of (50,100) with its diagonal alone having values
*Method one: indexing:* M = zeros(50,100); M(1:51:50^2) = V % vector V must have 50 elements A simple example: >...

9 years ago | 0

| accepted

Answered
For loop output each iteration to cell array
It appears that you need to move the preallocation of P_SUM to before the main loop: P_SUM = cell(1,numel(xs_current)); ...

9 years ago | 0

| accepted

Answered
how to declare two variables together in the for loop
R = 1:4; C = 2:5; for k = 1:numel(C) r = R(k); c = C(k); ... end

9 years ago | 0

Answered
Subscript indices must either be real positive integers or logicals.
Lets have a look at that line: mwreal(k,length(k)-w(k)/2) |k| is the scalar loop variable, which means that length(...

9 years ago | 0

| accepted

Answered
how to combinetwo matrix (2,5) and (3,5) together
vertcat(A,B)

9 years ago | 0

| accepted

Load more