Answered
Adding Data to an Existing Nx1 Double
Simplified a little: U = nan(264,1); U([9;37;38;39;49;50;51]) = 0; U(isnan(U)) = UR; * |find| is not required and ...

9 years ago | 0

| accepted

Answered
Keep custom colormap settings on different plots? (specific values = specific color)
You need to set the "color axis": <https://www.mathworks.com/help/matlab/ref/caxis.html>

9 years ago | 1

| accepted

Answered
How can I extract content froma website?
<http://blogs.mathworks.com/pick/2014/01/17/scraping-data-from-the-web/> <http://www.mathworks.com/matlabcentral/fileexchange...

9 years ago | 1

| accepted

Answered
split numbers into columns
If the input is numeric, try this: num = 123; num2str(num)-'0'

9 years ago | 2

Answered
How can I convert a date and time vector of components (datevec) back to datenum?
Your data has the incorrect number of columns for a date vector. When you read the <https://www.mathworks.com/help/matlab/ref/da...

9 years ago | 0

| accepted

Answered
Could anyone please help me to code this problem.
Just use |arrayfun|: >> C = arrayfun(@(n)M(1:n),maxtop,'uni',0); >> C{:} ans = 1 2 3 5 ...

9 years ago | 0

Answered
How to use cellfun in only cells with numbers or how to create a csv file with different elements (numbers and strings)?
This is easy with <https://www.mathworks.com/help/matlab/ref/num2str.html |num2str|>, which ignores strings. This has the advant...

9 years ago | 0

| accepted

Answered
How to save variables from output of function as vector?
function [ A, B] = GetText(filename) fid = fopen(filename,'r'); x = textscan(fid,'%n%s','headerlines',1); fclose(fid)...

9 years ago | 0

Answered
Assigning a cell array to a cell of a different cell array
_"This code works when child contains more than one element"_ No, it always puts that cell array there, whatever its size. Wh...

9 years ago | 0

| accepted

Answered
Manipulate multidimensional matrix in for loop
Use <https://www.mathworks.com/help/matlab/ref/permute.html |permute|> and <https://www.mathworks.com/help/matlab/ref/reshape.ht...

9 years ago | 1

Answered
How do I set F.ExtrapolationMethod to 'none' in function 'griddedInterpolant'?
The <https://www.mathworks.com/help/matlab/ref/griddedinterpolant-object.html |griddedInterpolant|> documentation shows that the...

9 years ago | 0

| accepted

Answered
Is it possible to declare a anonymous function globally?
Here are some options that <https://www.mathworks.com/matlabcentral/answers/51946-systematic-do-not-use-global-don-t-use-eval av...

9 years ago | 0

| accepted

Answered
Cannot plot a color gradient (Data must be a single matrix Y or a list of pairs X,Y.)
You can easily set the <https://www.mathworks.com/help/matlab/ref/axes-properties.html#property_d0e55094 line |ColorOrder|> prop...

9 years ago | 2

Answered
I have a 134985*8 matrix . how would i rename column '1' into some descriptive variable name 'Time' for column 1?
Array types in MATLAB allow the three kinds of indexing: subscripts, logical, and linear. These are explained in the documentati...

9 years ago | 0

Answered
Conversion to function_handle from double is not possible.
You create |p| as a |double| array at the start of your code: p=zeros(n,1); and then later you try to put a function han...

9 years ago | 2

| accepted

Answered
Plotting multiple lines with difference specific colours via plot function
You just need to set the <https://www.mathworks.com/help/matlab/ref/axes-properties.html#property_d0e55094 line |ColorOrder|> pr...

9 years ago | 0

Answered
Error in fmincon : how to write "fun" when x is an array?
Most importantly |noncon| needs to be a function (of |x|, which does not need to be used inside the function). Personally I do n...

9 years ago | 0

Answered
How to replace some values in a matrix?
Just use a <http://blogs.mathworks.com/loren/2013/02/20/logical-indexing-multiple-conditions/ logical index>: >> x = randi(...

9 years ago | 0

| accepted

Answered
Variable Depth Cell Array UnNesting Recursively
Download one of these: <https://www.mathworks.com/matlabcentral/fileexchange/27009-flatten-nested-cell-arrays> <https://ww...

9 years ago | 0

Answered
Finding missing array value of a singular matrix
A simple numerical solution using <http://www.mathworks.com/help/matlab/ref/fzero.html |fzero|>: >> fun = @(x)det([2,5,7;-2...

9 years ago | 1

| accepted

Answered
How to access an cell array using an cell array of indices
Using |cellfun| (not faster, just more compact): >> A = {[1,2,3],[4,5,6,7,8],[9,10,11,12]}; >> B = {1:2,2:4,1:3}; >> ...

9 years ago | 0

| accepted

Answered
How to configure the options of ga function ?
The <https://www.mathworks.com/help/gads/gaoptimset.html |gaoptimset|> documentation states under the option *MaxGenerations*: _...

9 years ago | 0

| accepted

Answered
Replace Specific Value in Specific part of the Main Matrix
>> A = [0,1,2,2,2,0,1,0,2;0,1,1,1,1,1,1,1,0;2,1,2,1,1,2,1,2,0;0,0,1,0,1,1,1,0,2;0,2,0,1,0,2,0,1,2;0,0,1,2,2,2,2,0,2]; >> A(...

9 years ago | 0

| accepted

Answered
I have a cell array with different types of data and I would like to cellplot
The function |cellplot| is written in an Mfile, which means that you could make a copy (for your own personal use only) and edit...

9 years ago | 0

| accepted

Answered
Is there a function that works like mathematica's Manipulate but in Matlab?
<https://www.mathworks.com/help/matlab/data_analysis/making-graphs-responsive-with-data-linking.html> <https://www.mathworks....

9 years ago | 1

Answered
Any suggestion to this problem?
Click and drag! Dock the editor or script, and then click-and-hold on the header/toolbar of that box (called a "tool" in the ...

9 years ago | 1

| accepted

Answered
How do I find the percentage of a number of values within a certain range?
>> M = rand(6,7)-0.5; % matrix of fake data >> X = -0.05<M & M<0.05; % check conditions >> nnz(X)/numel(M) ans = 0.0...

9 years ago | 0

| accepted

Answered
How can I extract from a vector the element which are in odd position? And in even position?
B = A(1:2:end) C = A(2:2:end) Very basic MATLAB usage, such as this kind of indexing, is introduced in the Getting Started...

9 years ago | 2

| accepted

Answered
Hi,. I need support in doing a double summation in MATLAB. Thank you.
>> M = bsxfun(@plus,2*(0:2),3*(0:3).'); >> sum(M(:)) ans = 78

9 years ago | 0

Answered
how to match complete row in cell array and then find index
*Method One: mixed types.* This will work with both strings and numeric values: >> C = {... % cell matrix 'anna','A',1;....

9 years ago | 2

| accepted

Load more