Community Profile # Benjamin

Last seen: Today Active since 2013

#### Statistics

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

View by

Error: Array indices must be positive integers or logical values
Avoid doing str2double on the slider value. Just do this: n=get(handles.slider1,'Value'); The error happens because str2double...

1 day ago | 1

| accepted

I need to load an image to apply my filter registration code but cannot get the image to load. The image is in a matlab file, but keep getting an error loading, line 9.
Put the file name in quotes, and put jpg in quotes: photo = double(imread('undergraduate_data.mat','jpg')); Otherwise the inte...

1 day ago | 0

Error using sgtitle?
sgtitle is interpreting the second argument you give it (i.e., ['Over 37.5 = ' num2str(meanover) 'Under 37.5 = ' num2str(meanund...

1 day ago | 0

Struggling to plot this graph
Remove the (i) indexing in your calls to plot. This will make plot create one line per call with all the time points rather than...

1 day ago | 0

Removing data from an array using subsets
Use logical indexing to identify and remove the zero-elements from x: x = [0;0;0;0;1;1;1;0;1;1]; x(x == 0) = [];

1 day ago | 0

| accepted

Adding values to a matrix in for loop
Each time through the loop, the code is concatenating the vector values_change onto the end of the vector values. (Note that the...

1 day ago | 1

outputs from nested functions
Each nested function has its own workspace but they all 'see' variables from the parent workspace. function parent() x =...

1 day ago | 0

Why do i get the error: Array indices must be positive integers or logical values?
This expression in the loop: deltaT((windTurbineRotorModel(WindSpeeds,Ct,D,Vcutout,Vrated,Vcutin))-(k*omegaRotor(i-1).^2)/j) s...

1 day ago | 0

| accepted

https://www.mathworks.com/help/symbolic/digits.html

2 days ago | 0

| accepted

how i can plot three vactors(x,y,T) useing contour
You cannot. contour requires a matrix.

2 days ago | 0

Finding coefficients of variables of specific powers
Problem 1: Try using the 'All' flag in your call to coeffs.

2 days ago | 0

| accepted

How would I get this started (kinda stumped)? I know I need to use a for loop but I am rusty on those.
The good news is you don't need to use a for loop. k = 1:100; result = sum(14*k.^3-20*k.^2+3*k);

2 days ago | 0

what does this error mean? Error using snr Expected input number 2, Fs, to be a scalar.
This error means that the second input argument to the function snr is interpreted by MATLAB - based on how your code calls snr ...

3 days ago | 0

Why won't my function graph?
You have to use .* (element-wise multiplication) rather than * (matrix multiplication): y = 3*exp(-x/3).*sin(pi*x);

3 days ago | 0

Loop. Do while loop in matlab
So you have some code like this, right? A = 0; while A < 8 % do something A = A+1; end This loop will iterate 8 ti...

3 days ago | 0

| accepted

Plot function in matlab
You can use loglog to get a plot with both axes in log scale or semilogx to get one with just the x-axis in log scale.

3 days ago | 0

How to plot two vectors and one matrice
surface(mute_rate,mute_step,results)

3 days ago | 0

How can I start the cumulative from a specific year?
load('DATI_ECM_GIORNALIERI') idx = find(DATIECMWFgiornalieri{:,1} == 2015,1); C1 = cumsum(DATIECMWFgiornalieri{idx:end, 4});

3 days ago | 0

| accepted

Different between plot after STFT and that using the surf function in Matlab
One surface is of SV and one is of 20*log10(abs(SV)). Does that explain the difference you observe?

3 days ago | 0

how to craet the same function but without loop
Here is one way: function Xne = decode( H, Zn0, nIter, verbose ) [ M, N ] = size( H ) ; LMN = zeros( M, N ) ; ZMN = repmat(...

3 days ago | 0

How to split 128x128 array into 64 ( 2x128 ) ?
Let x be your original (128x128) array. Here's one way to create 64 arrays of size 2x128, which I will store in a single cell ar...

3 days ago | 0

| accepted

why do I get an error when I pressthe radio button in my GUI
One error you might get is that variable 'radiobutton1' is undefined. You should refer to it as 'handles.radiobutton1'.

3 days ago | 0

Using for loop for cell array
clc;clear;close all bw = rgb2gray(imread('image_3.png')); figure;imshow(bw);title('orginal image') [B,~,N]=bwboundaries(b...

3 days ago | 0

| accepted

Arranging values from highest to lowest using sort function Matlab
sort_a = sort(a,'descend');

3 days ago | 0

| accepted

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

4 days ago | 0

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

4 days ago | 0

| accepted

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

4 days ago | 0

| accepted

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

4 days ago | 0

| accepted