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

5 years 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,...

5 years 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...

5 years 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...

5 years 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.

5 years 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...

5 years 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...

5 years 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...

5 years 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 ...

5 years 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; ...

5 years ago | 1

| accepted

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

5 years 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...

5 years 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');

5 years 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...

5 years 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...

5 years 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 ...

5 years 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

5 years 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...

5 years 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 ...

5 years 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 ...

5 years 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.

5 years 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...

5 years 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...

5 years 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...

5 years 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...

5 years 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...

5 years 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 ...

5 years ago | 0

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

5 years 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...

5 years 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...

5 years ago

Load more