Community Profile # Benjamin

Last seen: Today Active since 2013

#### Statistics

All
• • • • • • • • • • • • #### Content Feed

View by

Expected one output from a curly brace or dot indexing expression
Is St_Name a length-3 character vector, .e.g., 'acb', by chance? I ask because it doesn't seem likely that St_Name can be used a...

ongeveer 22 uur ago | 0

Trying to increase marker size in scatter plot caused my plot and data to be replaced by a blank blue screen.
You are using T.Dynamic_Pressure as the marker size, right? Marker size is in units of points-squared. I have no idea what kind ...

ongeveer 23 uur ago | 0

| accepted

what changes should I make if my input is struct
function agepts = femaleldlchdrisk(S) if S.age <= 34 agepts = -9; elseif S.age <= 39 agepts = -4; ...

ongeveer 23 uur ago | 1

| accepted

There will be 12 plots and I want to show 12 plots in one picture.
Maybe subplot will work.

ongeveer 23 uur ago | 0

Plotting a circle on top of a trisurf graph.
It may be that the circle is beneath the surface object. I mean, I would expect the circle's 'ZData' to be all zeros - the defau...

1 dag ago | 0

| accepted

How to create a plot with highlight (holes) based on Y value and colored density map based on X value
To do #1, add the following lines of code after your plot(y) line: hold on idx = y>-0.5 & y<0.5; plot(t(idx),y(idx),'o');

1 dag ago | 0

Extract data from dataset with no nans and loop over columns
I think, at least, these three lines: obsnew(m,n)=obs(m,n); sim1_new(m,n)=sim1(m,n); sim2_new(m,n)=sim2(m,n); should be mod...

1 dag ago | 0

| accepted

size argument must be real integer
30000 bits 7 bits per symbol --> 30000/7 = non-integer number of symbols, i.e., you cannot reshape dataIn into a matrix of sym...

1 dag ago | 0

| accepted

How do I add values into a vector
Here are four ways you can make a vector x that contains integers from 1 to 10. x = []; for i = 1:10 x(end+1) = i; end ...

1 dag ago | 0

Saving loop values as column vector
d = zeros(1,25); c = 6.25; x = 2.5; for loop = 1:25 d(loop) = c-(c^-2+x*c); c = d(loop); end

1 dag ago | 0

How do I store the results into a new matrix after looping it through every file.
Make B a cell array. Initialize it before your loop like this: B = cell(rows,1); Then store the result you get at the end of t...

1 dag ago | 0

Can you explain to me the last part of this code? Thanks in advance!
y=roundn(a,-4); rounds a to the nearest multiple of 10^-4 and stores the result in y. Fw(isinf(Fw))=A0; replaces elements of ...

1 dag ago | 0

| accepted

Sum matrix column orderly
This will work for your example_matrix: Final_matrix = movsum(example_matrix,3,1,'Endpoints','discard'); Maybe doing the same ...

1 dag ago | 0

Why do I get unrecognized function or variable 'ft_version' ?
This would be a question for the makers of Fieldtrip, like the message says.

7 dagen ago | 0

how to run different for loops in MATLAB
I'm not sure how Matlaboptimization.m gets called at all; you should call it in your code without the .m extension, i.e.: PEMAX...

7 dagen ago | 0

Double for loop problem. Function within 2nd for loop no longer works properly.
Move this line: FS = a0*Q; into your outer for loop (but still outside the inner loop). This will re-initialize FS each time t...

7 dagen ago | 0

| accepted

I want to create a 'if' for a probability
ate_carrots_last_year = false; if ate_carrots_last_year P_eat_carrots_this_year = 0.8; else P_eat_carrots_this_yea...

7 dagen ago | 1

| accepted

How can I simulate a hiker who goes in a different direction every time?
The idea is that you have to add the new x and y steps to the previous position each time through the loop. Change your for lin...

8 dagen ago | 0

What wrong with my code? anyone can help?
That line is "if n == l" with a lower-case L, which is not a defined variable, evidently. Maybe it should be "if n == 1", with t...

8 dagen ago | 0

Convert x axis to seconds
If you do the following, does it look right? % plot 2, data rms plot(([1:nwindow]-1)/fs, data_rms, 'k*'); % plot 3, min data ...

8 dagen ago | 0

How do i extract data from 3D matrix?
[m,n,~] = size(A); newA = reshape(permute(A,[2 1 3]),m*n,[]).';

8 dagen ago | 0

| accepted

Solved

Goldbach's marginal conjecture - Write integer as sum of three primes
Goldbach's strong conjecture states that every even integer greater than 2 can be expressed as the sum of two primes. For exampl...

13 dagen ago

Solved

QWERTY coordinates
Given a lowercase letter or a digit as input, return the row where that letter appears on a standard U.S. QWERTY keyboard and it...

13 dagen ago

What mistake I am making?
Using a loop: function [avg] = avgpositive7multiples_for (m) s = 0; a = 0; for t = 1:length(m) if m(t) > 0 && mod(m(t),...

21 dagen ago | 0

| accepted

loop storing only the last value, I want all values of the loop to be stored
Note that your assignment to Ts is independent of the loop iterator a, so each time through the loop Ts is assigned the contents...

21 dagen ago | 1

Create a script file using control flow statements that returns all the prime numbers from 2 till hundred.
This solution does not use any control flow statements: numbers = 3:100; prime_numbers = numbers(isprime(numbers)); This solu...

22 dagen ago | 0

What is this peak's meaning?
It means that the magnitude of the Fourier transform of this rainfall data has a local maximum at that frequency.

22 dagen ago | 0

Create a cicle 'for' to create multiple fields
data = struct(); fn = {'C028' 'C022' 'C008' 'C006'}; for i = 1:numel(fn) data.(fn{i}) = getfield(importdata([fn{i} ' S1.m...

22 dagen ago | 1

| accepted