Answered
ABOT THE DIFFRENCE BTWN 64BIT MATLAB AND 32 BIT MATLAB
Default numeric variables in Matlab are _*double*_ precision in all versions; only addressing range is expanded with indexing by...

11 years ago | 2

Answered
extracting positive numbers?
x=x(x>0); Look for "logical addressing" in documentation...

11 years ago | 0

| accepted

Answered
Fill blank spaces from lagged data with NaN
Instead of selecting the first N points, GRACEcrop = Approx1z(1:(96-m),j); just set the last _m_ to NaN... Approx1...

11 years ago | 0

| accepted

Answered
How to vectorize for loops?
To simplify, I presume copy the plane slice to a 2D array to eliminate the _k_ index from the expressions. The following duplic...

11 years ago | 1

| accepted

Answered
Selecting specific data from raw data based on conditions
Using _"logical addressing"_ is generally an efficient technique. I use a helper function I call *iswithin* to remove the compl...

11 years ago | 1

| accepted

Answered
Are these expressions equivalent? (seeing greater errors in vectorized expression)
Well, it isn't so easy to see; but the two expressions are _not_ the same thing...I was wrong in my conjecture earlier in not ha...

11 years ago | 0

| accepted

Answered
ksdensity doesn't return a pdf which sums to 1 and has problems at the boundary
Not necessarily, no. It'll depend on the range of the underlying estimated pdf covered in the input range of the data as well a...

11 years ago | 0

Answered
In a function with multiple outputs, if one output is empty does that output still need to be calculated within the function?
[a,b] = functionname(c) List of steps to calculate a if nargout > 1 List of steps to calculate b end ...

11 years ago | 1

| accepted

Answered
Extracting number with exponential from cell array
Use the appropriate format string in *textscan* to read as numeric instead of character. You don't show the file format but mat...

11 years ago | 0

Answered
how to convert a matrix to a cell?
c=mat2cell(m,ones(1,size(m,1)),2*ones(1,size(m,2)/2)); doc mat2cell % for details...

11 years ago | 0

| accepted

Answered
confused regarding scaling of axis for an array?
doc interp1

11 years ago | 0

Answered
How do I make the user input values into a matrix?
doc input >> x=input('Enter an array of values in []: ') Enter an array of values in []: [1 2 3 -8 2:pi:12] x = 1....

11 years ago | 0

| accepted

Answered
problem in using textscan to import data from csv
Filling a field with asterisks is Fortran convention if output magnitude exceeds available width for a field; possibly can you r...

11 years ago | 0

Answered
Time converted to a str
Again, pasting a (partial even) row of text with the actual field of interest would relieve confusion regarding the form, but pr...

11 years ago | 0

| accepted

Answered
How to use unique function to get data only when the number in one row increases
>> [a [true;diff(a)>0]] ans = 1 1 1 0 1 0 2 1 3 1 4 1 5 ...

11 years ago | 0

| accepted

Answered
I have a monthly time series data in matrix form with 4 columns. I want to sum up always the 3 row elements of the columns. 1-3,3-6,6-9,... ,to get quaterly data. How can I do this in matlab ?
I are complete years, then reshape(sum(reshape(x,3,[])),numel(x)/(3*size(x,2)),[]) If lacking complete year, operate on ...

11 years ago | 0

| accepted

Answered
Search for a part of a string in cell of cell array
It's a cellstr array, and yes, it can be confusing how to address them. The _content_ of the cell is a character string referen...

11 years ago | 1

Answered
How to count sequential NaN values
Presuming I get your intent, >> sum(diff([zeros(1,3);isnan(x)])==1) ans = 1 2 1 >> *ADDENDUM* Locat...

11 years ago | 0

Answered
How can I evaluate a function that is a function of other functions but all relate to the same parameter such as x
Just write it like any other Matlab expression... f1=@(x) C1*x.^2; f2=@(x) C2*f1(x); f3=@(x) C3*f1(x).*f2(x); This...

11 years ago | 0

Answered
MATLAB Graphs (Arbitrary X-Axis)
Oh, ok, I did misread the question, sorry... hAx2=axes('Position',get(gca,'Position'),'XAxisLocation','top'); xlim(hAx2,...

11 years ago | 1

| accepted

Answered
How to change the legend colored linewidth, not the width of box outline
Save the optional _object_h_ handle for the line and text objects in the legend axes and set their properties. You'll have to q...

11 years ago | 3

Answered
How to make probplot run in descending order?
set(gca,'xdir','reverse') % maybe???

11 years ago | 0

Answered
perform join without using dataset or table
[~,lib]=ismember(dat(:,1),w(:,1)); % location of year in data dat=[dat w(lib,2)]; % concatenate the weight...

11 years ago | 1

| accepted

Answered
How to compare value for two variable?
I presume you intended the three variables, not the same variable three times...simplest would be to first change storage/naming...

11 years ago | 0

Answered
i have c=300*10^6, 0<=v<=300*10^6, L=2 and the relation d= L (1- ( 1-(v^2/c^2) )^0.5 )
doc linspace doc logspace doc plot doc semilogx doc loglog

11 years ago | 0

| accepted

Answered
problem with converting dates to numbers
You seem to keep retrogressing past what we've already solved/shown solutions for. Why not build on the previously working solu...

11 years ago | 0

Answered
Transpose rows and collums inside a .mat file
_"2*8760 excel file that I need to turn in to a 8760*2 .mat file"_ *SAVE* uses strings as its arguments so you can't do the t...

11 years ago | 1

| accepted

Answered
Finding out if the max value in a vector is in a certain interval in a vector?
[~,idx]=max(C); % location of max in C imax=fix((idx-1)/16)+1; % compute the subsection

11 years ago | 1

| accepted

Answered
problem with converting dates to numbers
The problem isn't *datenum*, it's that you're trying to pass a cellstr array into it. If you're going to use *readtable*, use a...

11 years ago | 0

Load more