Remove 0 values from an array
% create a patterned array A = (1:10)' + (10:10:30); A([3 15 27]) = 0; row_has_zero = any( A==0 ,2) A(row_has_zero,:)=[]

2 mesi ago | 0

Splitting a matrix in vectors and combination of vectors
Note that this method results in a different sort from what you describe. You could use sortrows if the order is important to yo...

2 mesi ago | 0

| accepted

How to extract values from an array?
Using RunLength by Jan: array = [10 10 10 30 30 30 30 30 4 4 4 4 4 30 30 30 30 30 30 2 2 2 2 2 30 30 30 30]; %first select o...

2 mesi ago | 0

Storing values in a matrix

2 mesi ago | 0

| accepted

Finding row indices of a cell array containing a certain element
A simple loop should do: arr = cell(4,1); arr{1,1}=1:3:15; arr{2,1}=2:2:20; arr{3,1}=3:3:30; arr{4,1}=0:4:10; L=false(nu...

2 mesi ago | 0

save variables in Matlab GUI
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. With your current se...

2 mesi ago | 0

How to access app designer GUI pushbutton callback inside my function?
My suggestion would be to move the code you want to call to a separate function. In my view, the callback of an object should on...

2 mesi ago | 0

"Too many input arguments" when calling a constructor with named arguments
Your current syntax ( nfet(LEVEL=1) ) will be passed to your contructor as "LEVEL",1 (if you want a syntax that is compatible wi...

2 mesi ago | 0

| accepted

Bringing arrays to the same length
There are two issues with the solution by Arif: It uses find on a logical array, but that is only used to index an array It as...

3 mesi ago | 1

How to generate dataset automatically using MATLAB
Maybe you want this? total_samples_per_class=5e5; prfSTG = [200 400 800 1000 900 ]; n_pulsesSTG = [800 800 800 800 800 80...

3 mesi ago | 0

I want to build aa matrix by choosing a random value of x1,x2 ... from -1to 1, 1000 times? Could anyone help?
Turn your numbered variables into an array. Then you can use randi to randomly select from those values.

3 mesi ago | 0

| accepted

How can I use Loop to read multiple matrixes and sum rows?
You can load the mat file to a struct and loop through the fields. Now you also immediately see why numbered variables are a bad...

3 mesi ago | 0

| accepted

Plotting Multiple Box plot in same graph same x axis
You can group them in bins from 1 to 15 and tweak the x labels to match your needs. See the documentation for how to use 'Group...

3 mesi ago | 0

How to list the directories of multiple folders?
base_path='C:\Users\Desktop\Stats\'; P=cell(5,1); for n=1:numel(P) P{n}=sprintf('%sID%03d_Stats',base_path,n); end P

3 mesi ago | 0

| accepted

Adding a progress bar in App Designer inside a callback
To increase performance, Matlab does not automatically update graphics elements on the screen after a function call that modifie...

3 mesi ago | 1

| accepted

How to get Matlab C++ compiler name in my program?
If starting Matlab is fine, then this code will get you all the info you need: details=get_cpp_compiler_info function details=...

3 mesi ago | 0

How can I find the line after the line containing the text I am looking for?
There are two general ways to this: Read the data all at once, then do your analysis on the full file, then write the complete ...

3 mesi ago | 0

| accepted

How to create GUI for Transmitting and receiving image using MATLAB
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread. As @Benjamin Thompson...

3 mesi ago | 0

coloration the pixels matlab
The easiest way to do this is to create an index image and then use ind2rgb to convert to a color image. im1=imread('https://ww...

3 mesi ago | 0

How do I solve this matrix in a loop for different values for P?
I'm guessing you want a for loop like this: x1= linspace(-0.005,0.005,10); x2= linspace(-0.005,0.005,10); x3= linspace(-0.005...

3 mesi ago | 1

| accepted

Guidelines for appropriate moderation?
Sorry, this post is not very structured, maybe I'll edit it if this thread gets more attention. What I personally tend to do ...

3 mesi ago | 2

How can we write unsigned long value in matlab?
As I understand it, this would be a casting operation, equivalent to the Matlab function cast. (note that typecast changes the d...

3 mesi ago | 0

What type of Build in function used for plot such graph? or how to plot such graph?
The plot3 function will do this. help plot3

3 mesi ago | 0

Boxplot how to make the box widths proportional to sample size
There is no function in Matlab that does this natively, but you can write it from scratch. If it is important to you that you...

3 mesi ago | 0

How I can do auto-resized axes in App Designer?
You should confirm the units property of your axes is set to normalized. If this is not possible you will have to use a listener...

3 mesi ago | 0

How to curve fit an equation that gets values from another equation?
There is probably something wrong with your loop, as you're using e both in the first part as an array, and in the second part. ...

3 mesi ago | 0

Why two variables loading the same .mat file are not equal ?
I guess boldly: There might be a NaN value hidden somewhere in your data: isequal(NaN,NaN) You might be interested in my Comp...

3 mesi ago | 3

| accepted

Can I create function that use default input unless a user gives one?
The code you show is almost exactly what you describe (except for the <0 instead of <1): if the user doesn't provide an input, i...

3 mesi ago | 0

| accepted