Community Profile

# Benjamin

Last seen: 1 day ago Active since 2013

All

View badges

#### Content Feed

View by

Answered
Vectors must be the same length
plot takes vectors in pairs of arguments, like plot(x1,y1,x2,y2, ...) The second call to plot in your code uses three numeric a...

23 hours ago | 0

Answered
How to return the graph axis from 3d axis to 2d axis after I click on the clear button (In GUI)?
One way is: set(gca(),'View',[0 90]); This assumes that your axes is the current axes in the current figure. If this is not th...

23 hours ago | 0

| accepted

Answered
I want to input an array of odd/even mixed numbers like [ 1 2 3] and i want the output to be like [ odd even odd] . Added my code, its showing error, Can you tell me where i
S cannot be a numeric matrix if it's going to contain character arrays. It can be a cell array though: A = [1 2 3 4; 5 6 7 8; 9...

23 hours ago | 0

| accepted

Answered
Different result with Run (F5) and line by line debugging (F10)
Someone more knowledgeable than me may know for sure, but it may be because the event queue gets processed each time you dbstep,...

23 hours ago | 0

| accepted

Answered
Comparing elements of cell arrays
I don't know whether it's feasible to change your code in the way I'm about to suggest, but it may be worthwhile to store the li...

1 day ago | 0

Answered
How to separate a vector into two different vectors?
Probably the easiest way to do what you want is to use logical indexing. First make a vector of logicals that say whether each e...

1 day ago | 1

Answered
Getting this error in the following code:Error using audiowrite (line 116) Expected input to be real. Error in ll85 (line 102) audiowrite('masked.wav',y,fs);
Sounds like one or both of your variables y and fs has a non-zero imaginary part. You can use isreal to check on that.

2 days ago | 0

Answered
Find the index of a value which is a variable in an array
Sounds like azimuth_angle is not exactly 195, but it's something very close to 195. So instead of using find to find an exact m...

2 days ago | 0

| accepted

Answered
Black jack function for hiding dealers card
I'll assume the dealer's cards are stored as an array with the hole card being first. Then here's a function that takes two inpu...

2 days ago | 0

| accepted

Answered
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...

3 days ago | 0

Answered
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 ...

3 days ago | 0

| accepted

Answered
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; ...

3 days ago | 1

| accepted

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

3 days ago | 0

Answered
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...

3 days ago | 0

| accepted

Answered
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');

3 days ago | 0

| accepted

Answered
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...

3 days ago | 0

| accepted

Answered
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...

3 days ago | 0

| accepted

Answered
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 ...

3 days ago | 0

Answered
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

3 days ago | 0

Answered
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...

3 days ago | 0

Answered
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 ...

3 days ago | 0

| accepted

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

3 days ago | 0

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

9 days ago | 0

Answered
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...

9 days ago | 0

Answered
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...

9 days ago | 0

| accepted

Answered
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...

9 days ago | 1

| accepted

Answered
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...

10 days ago | 0

| accepted

Answered
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...

10 days ago | 0

Answered
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 ...

10 days ago | 0

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

10 days ago | 0

| accepted