Answered

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,:)=[]

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

Answered

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

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

Answered

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

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

Answered

Storing values in a matrix

You're already there: for column = 2:width(cooling_load) x = table2array(cooling_load(:,column)); for i = 0:364 ...

Storing values in a matrix

You're already there: for column = 2:width(cooling_load) x = table2array(cooling_load(:,column)); for i = 0:364 ...

2 mesi ago | 0

| accepted

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

"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

Answered

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

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

Answered

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

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

Answered

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.

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

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

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

Answered

how do i plot a straight line and also change then range of the x axis and y axis ?

I suspect you want something like xline or yline: Vonew=45; Vonew2=15 vin=30; y=Vonew; %i get my Voutnew=45 x=Vonew2; plot...

how do i plot a straight line and also change then range of the x axis and y axis ?

I suspect you want something like xline or yline: Vonew=45; Vonew2=15 vin=30; y=Vonew; %i get my Voutnew=45 x=Vonew2; plot...

3 mesi ago | 0

Answered

Calculate min/max/mean value every 100 points

Reshape will work, but you have to pad with NaN values and set the 'omitnan' flag: data=rand(1,17999); data(end+(1:mod(-end,10...

Calculate min/max/mean value every 100 points

Reshape will work, but you have to pad with NaN values and set the 'omitnan' flag: data=rand(1,17999); data(end+(1:mod(-end,10...

3 mesi ago | 1