回答済み
Problem with IF statement
Don't use clear all. You don't need it. I suspect you encountered the wondrous world of floats. Computers don't have infinite...

5年以上 前 | 0

回答済み
Old MATLAB Online Courses
The basics haven't changed (much) since then. For an incomplete overview, see this thread. You can also do the Onramp tutorial ...

5年以上 前 | 0

| 採用済み

回答済み
I'm trying to input a data set to calculate the Gaussian (Normal) Distribution. This something that i found on youtube but I keep getting the error: Error in my_gaussian (line 4) f = zeros(n, 1); When i hit Run. What is this error about ?
How is Matlab supposed to know the input values? If you hit the green run button you execute the function without any inputs. ...

5年以上 前 | 0

回答済み
Data fitting by non linear discrete equation.
The code below uses fminsearch, which means you don't need the optimization toolbox. The downside is that it is sensitive to a l...

5年以上 前 | 0

| 採用済み

回答済み
Output only numbers with complex conjugate
a = [1+1i*0.1, 1-1i*0.1, 5-1i*0.1, 10+1i*0.2, 10-1i*0.2]; b=conj(a); c=b(ismember(b,a)); d=real(c)+1i*abs(imag(c)); e=unique...

5年以上 前 | 1

回答済み
How to make a loop of a calculator that keeps asking until the input is zero/nothing?
You forgot to convert the result to a number, so it is a char array. %radian = input ('Input a number: ', 's'); %Input a numbe...

5年以上 前 | 1

| 採用済み

回答済み
From for to While loop
Your original for-loop probably was incorrect. And why do you want a while loop? You already know how many iterations you want. ...

5年以上 前 | 0

| 採用済み

回答済み
Possible combinations for a vector
s=[0,0,0,0,0,0,0,0,0]; max_value_of_s=2; num_combinations=(max_value_of_s+1)^numel(s); disp(num_combinations) That is going ...

5年以上 前 | 1

回答済み
How do you circshift progressive rows an increasing amount?
You need to index a column in A in your output as well. for K = 1:size(A,2) A(:,K) = circshift(A(:,K),K); end If you want...

5年以上 前 | 0

| 採用済み

回答済み
How do I overwrite a structure using a switch statement.
You can copy the code I used in my FEX submissions (see WBM, readfile, BlandAltmanPlot or RegGrow). If you simply want to ove...

5年以上 前 | 0

回答済み
Keep getting an error as 'ASCII file unsupported' which terminates the code
The solution is in the error message: "Saving sparse arrays to an ASCII file is unsupported." Either use full to convert your s...

5年以上 前 | 0

| 採用済み

回答済み
Selecting parts of HTML file
First read the html files (you can get my readfile function from the FEX. If you are using R2017a or later, you can also get it ...

5年以上 前 | 0

| 採用済み

回答済み
How to eliminate standalone 1 or 0 in binary matrix
I would suggest using a convolution with a flat kernel. kernel=ones(1,3,1);kernel=kernel/sum(kernel(:)); A=[0 0 1 1 1 0 1 1 0 ...

5年以上 前 | 1

| 採用済み

回答済み
how to extract a specific text/string from text file
You can either use my readfile function (which you can get from the file exchange or the add-on manager). Another option is to u...

5年以上 前 | 2

回答済み
Count the number of times a sequence in a matrix repeats
Both the unique and ismember functions can handle rows. Look at the respective documentation pages for details.

5年以上 前 | 0

回答済み
Split RGB Image into blocks (24-bit)
The better solution would be to use blockproc, but you can also use mat2cell and use a loop.

5年以上 前 | 0

回答済み
How to perform circshift on specific elements?
You are overwriting the original array, instead of using circshift on the partial array. A = [1 2 3 4; 5 6 7 8; 9 10 11 12]; L...

5年以上 前 | 0

| 採用済み

回答済み
displaying the total number of times an if statement is true
You can use the fact that sum will functionally cast your logical array to 0 and 1: grains=sum(xc_array(:,1)>0.188); fprintf('...

5年以上 前 | 0

| 採用済み

回答済み
loop iteration in matlab
I would suggest not using a loop: F=@(x) sum( ( (1:x).^5 ).*(x:-1:1) );

5年以上 前 | 0

回答済み
Removing white background from Barcode image(s)
The easiest solution is to not add the border in the first place: barWidth = 3;barHeight = 100;appendTerminationMarkers = false...

5年以上 前 | 1

| 採用済み

回答済み
turn a vector into a scalar
I guess boldly: g=sym('0.1178542134') g_=double(g) %convert the scalar sym to a scalar double

5年以上 前 | 1

回答済み
Thresholding a value in matrix
You can use the comparator operators to apply a threshold: data=randi(200,8,8); L= data<100; %L is true for all positions with...

5年以上 前 | 0

| 採用済み

回答済み
How to colorize a range of pixel values in a grayscale image?
You can either adjust the colormap, or use imshow. If your image is not uint8, you will have to scale it down to [0,1] to make s...

5年以上 前 | 0

回答済み
product selection for a mechanical engineer
If you have disk space to spare you can install all toolboxes that are available to you. Another strategy would be to only inst...

5年以上 前 | 2

回答済み
How to remove file extension when using ugetfile in app designer?
The easiest way to remove an extension is with fileparts: [p,f,e]=fileparts(fullfilename); fullfilename=fullfile(p,f);

5年以上 前 | 2

| 採用済み

回答済み
How to insert numbers into a empty vector in a loop
You should not put it in an empty vector. You should put the results in an array: [m,s]=ndgrid(1:5); xOut=zeros(size(m)); cou...

5年以上 前 | 1

回答済み
Not enough input arguments for function length()
You are calling the a4_q3b function without input arguments. You did not give it any value for x, so when you try to use it, you...

5年以上 前 | 1

回答済み
how to do sum of element of multiple number in matlab?
b=cumsum(m); b=b(c);

5年以上 前 | 3

| 採用済み

回答済み
Delete patch in Matlab
Here is an example of what I wrote in my comment: t=linspace(0,2*pi,200); x=sin(t);y=cos(t); x=[x 0 0 2 2 -2 -2 0 0]; y=[...

5年以上 前 | 0

回答済み
Copying all contents of a figure into another figure in Matlab GUIDE by clicking on a figure?
(Caveat: I haven't tried running any of this code) What are you expecting to happen when you set the ButtonDownFcn? It doesn't ...

5年以上 前 | 1

| 採用済み

さらに読み込む