Community Profile

photo

the cyclist


3,796 total contributions since 2011

Data scientist at Cohen Veterans Bioscience; Obsessive runner. Professional Interests: Predictive modeling, statistics.

Contact

the cyclist's Badges

  • Scavenger Finisher
  • Thankful Level 4
  • 36 Month Streak
  • Ace
  • Likeable
  • Famous
  • Quiz Master
  • Revival Level 3
  • Knowledgeable Level 4
  • First Answer
  • Puzzler
  • Speed Demon
  • Creator
  • Promoter
  • Commenter

View all

Contributions in
View by

Answered
Cell to matrix average
I believe this does what you want: B = squeeze(mean(reshape(cell2mat(A),93,145,147,19)));

3 days ago | 0

Answered
Delete rows in intervall
If your vector is a multiple of 7 in length, then this will work: x = reshape(x,7,[]); x = x(1:4,:); x = x(:);

3 days ago | 0

Answered
Bin data in a strange way
% Simulate some data data = [0; 0; -10; -2766; -5600; -5535]; % Define bin centers binCenter = [ 0, -2765, -5530, -8295, -...

3 days ago | 0

| accepted

Answered
How to extract first non-zero element in each column and put into a new array
Here is one way: in=[0 0 6 0 0 5; 1 3 5 1 0 4; 4 4 5 3 4 5]; [m,n] = size(in); out = nan(1,n); for nc = 1:n ...

4 days ago | 0

Answered
How to extract first non-zero element in each column and put into a new array
Here is one way: in=[0 0 6 0 0 5; 1 3 5 1 0 4; 4 4 5 3 4 5]; mid = in; for nr = size(in,1)-1:-1:1 mid(nr,...

4 days ago | 0

Answered
How to extract first non-zero element in each column and put into a new array
Here is a one way: in=[0 0 6 0 0 5; 1 3 5 1 0 4; 4 4 5 3 4 5]; [m,n] = size(in); [i,j] = find(in); [~,jj] =...

4 days ago | 0

Answered
for loop to create a vector V of the squares
Because this is a very basic MATLAB question, and you don't even know how to start, I would recommending watching the MATLAB Onr...

4 days ago | 0

Answered
How do I determine which model fits my data the best?
The second output from the fit command gives goodness-of-fit statistics. You might also take a look at "Determing the Best Fit"...

4 days ago | 0

Answered
Plotting circles in a for loop using a time step
Your code runs fine for me, and creates a figure. What's the problem? What's your question? I'm going to take a stab at an answ...

4 days ago | 0

Answered
Find the cell index in a nested cell array, corresponding to a string (by using strcmp)
Here is a one-liner: cellfun(@(y)any(any(cellfun(@(x)isequal(x,{'BLUE'}),y))),A) I stumbled across this function for dealing w...

4 days ago | 0

Answered
sorting matrix in ascending order based on column 1 (and ascending order also for column 2)
Use the sortrows command. B = sortrows(A,1);

6 days ago | 0

| accepted

Answered
How do I create a 1x21 matrix where the inputs are all the different values of d
Does this code do what you had intended? (There was some guesswork on my part.) B=[1 2 3 4 5 6 7; 9 11 13 15 17 19 21]; Norm...

6 days ago | 0

| accepted

Answered
Reading through folders getting the warning : ." Index in position 1 exceeds array bounds (must not exceed 1).".
At some point, did you define a variable named dir? MATLAB would then try to access that variable, rather than the command. Clea...

6 days ago | 0

| accepted

Answered
Plotting within a nested for loop
I'm guessing you wanted something like plot(x2,y,'.') or possibly plot(x2,y)

6 days ago | 0

Answered
How can I count the largest number of repeated numbers in a double?
I recommend downloading the RunLength utility from the File Exchange.

7 days ago | 0

Answered
What is difference between isequal and == in comparing two vectors
isequal will return a single logical value, indicating whether or not the two vectors are identical. == will give a vector with...

7 days ago | 3

Answered
how to create a for loop 380:780?
I would use a cell array, not variable names that also encode an index: for ic = 380:780 CM4{ic} = spec_data(spec_data.wav...

7 days ago | 0

| accepted

Answered
What does this command mean?
I'm guessing it's this.

7 days ago | 0

Answered
Confidence interval in Linear Regression
I'm curious why you want to code them from scratch, but the formulas for the standard errors and confidence intervals for the sl...

7 days ago | 0

Answered
find possible combinations of each row of matrix and allocate their respective values into 2 different matrices
% The input data A = [0.3939 0.3116]; B = [1 16 17 6 9 0 0 0 0 0 0 0 0 0 1 16 17 6 7 8 10 0 0 0 0 0 0 0 ]; ...

8 days ago | 0

| accepted

Answered
Is it possible to draw a bar plot with percentage lines?
I'm not sure if you are asking for them to be automatically positioned, but there are many options for drawing lines on a plot: ...

8 days ago | 1

Answered
Having trouble getting legend to display properly
One possibility is to set the 'Visible' property of those axes to 'off'. Here is a simpler example ... figure plot(magic(3)) ...

8 days ago | 0

Answered
Refund on MatLab purchase
You should contact sales.

9 days ago | 2

Answered
How to shorten my data in the struct I have?
The problem is that you are trying to resize your variable "in place". You can't really do this in pieces. One solution would b...

9 days ago | 1

| accepted

Answered
Sensitivity-Specificity of clustering result (no labeled data)
I was really tempted to just write the one-word answer, "No". But, instead I'll say that I just don't see how it could be possi...

9 days ago | 0

Answered
how do I get the values of a matrix using movsum to add 90 consectuive cells in the matrix?
This task will be trivial if you use the RunLength utility from the File Exchange.

10 days ago | 0

| accepted

Answered
Fill an array over an iteration
Does using BBB(i,:)=Dstop instead of BBB(i,:)=B(:) do what you want? If not, you need to explain a bit more.

10 days ago | 0

| accepted

Answered
How to to report row at which the difference reaches below a threshold?
Probably the hardest part will be defining the exact rule for "sufficiently small difference". After that, I think something lik...

11 days ago | 0

| accepted

Answered
Take values from a matrix, line by line.
I would do this as follows: WDV = exp(A.'); and any time later I need to refer to "W", I would reference WDV(:,1). If you abs...

14 days ago | 0

| accepted

Answered
Unable to debug the problem in the code.
I'm guessing it's a problem with floating-point precision when you do this comparison: (time-flag*carrier_time_period)== carrie...

14 days ago | 1

| accepted

Load more