Answered
How to generate sequences from two vectors using rowfun
You could use |arrayfun| instead: >> x = [1,6,12]; y = [5,10,13]; >> cell2mat(arrayfun(@(a,b)a:b-1, x,y,'UniformOutput',...

10 years ago | 1

| accepted

Answered
why is "~$" appearing in front of my excel file names?
These are temporary files created by Windows Office: <https://support.microsoft.com/en-us/kb/211632> <http://answers.micro...

10 years ago | 1

| accepted

Answered
Add 0 at end of double
You don't need to do any slow string conversions: >> vec = [25521,45674,45618,29466,3346,36024,5082,47221,42987]; >>...

10 years ago | 1

Answered
How i add a single character in start and end of my text file
Assuming that the file contains only ASCII characters: % Define character to add: new = 'X'; % Read file into string: ...

10 years ago | 0

Answered
Having trouble graphing multiple subplots while using a for loop. Please help! Much appreciated
You have created too many loops. Only the outer loop in needed, the inside one should be replaced by a simple <http://www.mathwo...

10 years ago | 0

Answered
Why does MATLAB r2016a not recognize "cheby1" as a function?
The function <http://www.mathworks.com/help/signal/ref/cheby1.html |cheby1|> is part of the <http://www.mathworks.com/help/signa...

10 years ago | 1

| accepted

Answered
Hey guys is it possible to write a 'for' loop for my code?
>> vec = [6,7,8,9,10,11,12]; >> Ltest = 0.75; >> x = randi(9,342,1); >> R = vec / Ltest; >> out = x * R;

10 years ago | 0

Answered
Need help to create a matrix for the use of intlinprog!
Just use <http://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: >> Z = [0;0;1;0;1;0;0;1;0] Z = 0 ...

10 years ago | 1

| accepted

Answered
Convert an string stored in a cell to a number
You could use <http://www.mathworks.com/help/matlab/ref/ismember.html |ismember|>: >> key = {'N','E','M'}; >> data = {'E...

10 years ago | 0

| accepted

Answered
How to normalise corresponding columns in several matrices to values between -1 and 1?
Try this: % define normalize bounds and function: lwr = -1; upr = +1; foo = @(m,n,x)lwr+(upr-lwr)*bsxfun(@rdivide,...

10 years ago | 0

Answered
Deleting several lines from text file (.txt)
If you only need to copy those lines form one file to another, then try something like this: fid = fopen('test.txt','rt'); ...

10 years ago | 0

| accepted

Answered
transfering the one row matrix into multiple row matrix with the same data
You can use <http://www.mathworks.com/help/matlab/ref/reshape.html |reshape|> and <http://www.mathworks.com/help/matlab/ref/tran...

10 years ago | 0

| accepted

Answered
how to sort the elements of 2D matrix and understand their initial column and rows of each elements?
Perhaps you want something like this: >> a = [7,10,6;8,6,11] a = 7 10 6 8 6 11 >> [R,C]...

10 years ago | 1

| accepted

Answered
How can I assign numeric values to strings in an array?
SpeciesName = { 'RH' 'OH' 'RO2' 'H2O' 'NO' 'NO2' 'RCHO' 'HO2' '...

10 years ago | 0

Answered
closest index in matrix between two values
X = [0 0 0 0 0; 1 1 1 1 1; 0 1 2 1 0; 1 1 1 1 1; 0 0 0 0 0]; [R0,C0] = find(X==0); [R2,C...

10 years ago | 0

| accepted

Answered
interpolation using the floor function
This is not accepted MATLAB syntax: time[floor(t/30)] The |[]| operator is used for <http://www.mathworks.com/help/matlab...

10 years ago | 1

| accepted

Answered
Not enough input arguments error with fplot
The function that you are providing to |fplot| is the problem. You should read the <http://www.mathworks.com/help/matlab/ref/...

10 years ago | 1

| accepted

Answered
Saving a file in a particular folder with wavwrite?
tmp = fullfile(pathname,filename); wavwrite(...,tmp)

10 years ago | 1

| accepted

Answered
equivalent of "a(b==1,:) = 3" for cellarray
_"I have to loop over every possible name."_ No looping is required, because <http://www.mathworks.com/help/matlab/ref/regexp...

10 years ago | 0

Answered
How does one have arrays in a Matlab share the same memory
It seems to be possible to do this with <http://www.mathworks.com/help/matlab/ref/memmapfile.html |memmapfile|>: myData = i...

10 years ago | 0

| accepted

Answered
Write a function with input .xls file to read'
function Econometric = Analysis(filename) Stock = xlsread(filename,1,'B2:B263') ... the rest of your code end As expla...

10 years ago | 0

Answered
Associate index of equal element in two arrays
>> [idxB,idxA] = find(bsxfun(@eq,B,A.')) idxB = 4 5 2 3 1 idxA = 1 2 3 ...

10 years ago | 1

Answered
how can I use matlab interpolation?
>> inp = randi(9,4,5) inp = 8 4 3 6 4 2 1 1 4 2 8 8 5 2...

10 years ago | 0

Answered
Using "for" to create loops
Why waste time with a loop? <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html Code vectorization> is much mor...

10 years ago | 1

| accepted

Answered
How to cut an array and reshape it while keeping the content in order?
This code can easily be changed to split the matrix into two, three, or more blocks. It assumes that the number of columns is di...

10 years ago | 0

Answered
Please help me in inserting ones in a given matrix in special rows
MATLAB is a high-level language, so there is no need to waste time with ugly loops as if this was some poor low-level language l...

10 years ago | 2

Answered
How do I save results from a loop into a table?
Often it is much easier and simpler to avoid the loop: >> A = 1:10; >> [A.',3*A.'] ans = 1 3 2 ...

10 years ago | 0

Answered
Error : Value must be a vector or 2D array of numeric type
The problem is how you are calling <http://www.mathworks.com/help/matlab/ref/meshgrid.html |meshgrid|>, because calling it with ...

10 years ago | 2

| accepted

Answered
How to make a vector linearly spaced?
It is quite likely that your two vectors do not actually have exactly the same values, due to <http://www.mathworks.com/help/mat...

10 years ago | 0

| accepted

Answered
What is the standard type of operations in MATLAB?
From the <http://www.mathworks.com/help/matlab/numeric-types.html numeric data types> documentation: _"By default, MATLAB stores...

10 years ago | 0

| accepted

Load more