Answered

How to add 0 in a column to form an array in which all columns are with equal rows?

here is an example: a = [1 2 3]'; b = [1 2]'; c = [1 2 3 4 5 6 7]'; sets = {a,b,c}; % let a, b, and c be your column sets. ...

How to add 0 in a column to form an array in which all columns are with equal rows?

here is an example: a = [1 2 3]'; b = [1 2]'; c = [1 2 3 4 5 6 7]'; sets = {a,b,c}; % let a, b, and c be your column sets. ...

1 month ago | 0

| accepted

Answered

Check for column in table

any(ismember(Table_1.Properties.VariableNames,'Column1')) strcmp works too, in place of ismember

Check for column in table

any(ismember(Table_1.Properties.VariableNames,'Column1')) strcmp works too, in place of ismember

1 month ago | 0

Answered

Find all lines of a matrix which have a matching pair of values

A = [1 2 3 4; 2 5 7 8; 4 5 7 9; 4 6 7 13; 6 8 13 15]; Pairs = [5 7; 4 7; 6 13]; index =zeros(size(Pairs,1),1); for i = 1:size...

Find all lines of a matrix which have a matching pair of values

A = [1 2 3 4; 2 5 7 8; 4 5 7 9; 4 6 7 13; 6 8 13 15]; Pairs = [5 7; 4 7; 6 13]; index =zeros(size(Pairs,1),1); for i = 1:size...

3 months ago | 0

Answered

compare the elements of multiple matrix and return min and max matrix

A = [1 92 33; 4 15 66; 16 27 48]; B = [34 45 16; 67 38 19; 2 83 31]; C = [20 53 61; ...

compare the elements of multiple matrix and return min and max matrix

A = [1 92 33; 4 15 66; 16 27 48]; B = [34 45 16; 67 38 19; 2 83 31]; C = [20 53 61; ...

3 months ago | 1

Answered

How to sum up multiple vectors, element by element, to recieve one final value?

example: W = [1 2 3 4 5]; O = [1 2 3 4 5]; %do the numerator first: E = W.*O; %element wise product %sum up the produ...

How to sum up multiple vectors, element by element, to recieve one final value?

example: W = [1 2 3 4 5]; O = [1 2 3 4 5]; %do the numerator first: E = W.*O; %element wise product %sum up the produ...

3 months ago | 1

| accepted

Question

How to Re-position DataCursormode 'Window'

So Matlab figures have a datacursormode that either show up as a datatip or a window. I would like to make use of the window bu...

3 months ago | 1 answer | 0

Answered

Count number of elements in a matrix more or less than given numbers

x = 10; y = 20; sum(A(:,2)<x | A(:,2)>y)

Count number of elements in a matrix more or less than given numbers

x = 10; y = 20; sum(A(:,2)<x | A(:,2)>y)

3 months ago | 1

| accepted

Answered

Replace largest elements in matrix with NaN

A =[17 2 5 68 79 28 900 17 77 63 90 87]; n = 3; elem = sort(A(:,1),'d'); elem =...

Replace largest elements in matrix with NaN

A =[17 2 5 68 79 28 900 17 77 63 90 87]; n = 3; elem = sort(A(:,1),'d'); elem =...

3 months ago | 1

| accepted

Answered

Plot using same colors

To plot in a specific color, scroll down in : https://www.mathworks.com/help/matlab/ref/plot.html so you can do something like...

Plot using same colors

To plot in a specific color, scroll down in : https://www.mathworks.com/help/matlab/ref/plot.html so you can do something like...

3 months ago | 0

Answered

Find if max elements in array < or > a given number

a = [6 7 4 8 9]; val = numel(a); if sum(a >= val) > val/2 disp(['Max elements greater than or equal to: ' num2str(val)]);...

Find if max elements in array < or > a given number

a = [6 7 4 8 9]; val = numel(a); if sum(a >= val) > val/2 disp(['Max elements greater than or equal to: ' num2str(val)]);...

3 months ago | 1

| accepted

Answered

What's the best way to shorten this?

a for loop! https://www.mathworks.com/help/matlab/ref/for.html

What's the best way to shorten this?

a for loop! https://www.mathworks.com/help/matlab/ref/for.html

3 months ago | 1

Answered

How to use windowkeypressfcn

function keyP(source, event) KeyPressed=event.Key; if strcmp(KeyPressed,'escape') view(3) end end It's as the error ...

How to use windowkeypressfcn

function keyP(source, event) KeyPressed=event.Key; if strcmp(KeyPressed,'escape') view(3) end end It's as the error ...

3 months ago | 0

Answered

Why won't this program run?

STEPS = 100; tau = 10; t0 = 2*tau; dt = 1; t = [0:STEPS-1]*dt; gE = zeros(1,STEPS); for i = 1:STEPS a = dt*ST...

Why won't this program run?

STEPS = 100; tau = 10; t0 = 2*tau; dt = 1; t = [0:STEPS-1]*dt; gE = zeros(1,STEPS); for i = 1:STEPS a = dt*ST...

3 months ago | 0

| accepted

Answered

How to get a single value of an array through a function inside a script?

function Eg = Esrc(u,a) a = dt*u; %% I want to use the a that is defined above in the code. fo...

How to get a single value of an array through a function inside a script?

function Eg = Esrc(u,a) a = dt*u; %% I want to use the a that is defined above in the code. fo...

3 months ago | 0

| accepted

Question

How to find installation folder for matlab add-ons via command line?

Hi, I have a gui (made through a class method, in a class folder) that on start up checks whether or not the user has a specific...

4 months ago | 0 answers | 1

Answered

Updating variable matrix values to static boxes in GUI !

make sure your function main_file_run() actually has an output, so in that function: function x = main_file_run() % blah blah...

Updating variable matrix values to static boxes in GUI !

make sure your function main_file_run() actually has an output, so in that function: function x = main_file_run() % blah blah...

4 months ago | 0

Answered

Using a while loop with a vector

Your while loop actually only runs once because after the first iteration, B>360 returns a logical array of [0 0 0 1 1 1], so it...

Using a while loop with a vector

Your while loop actually only runs once because after the first iteration, B>360 returns a logical array of [0 0 0 1 1 1], so it...

4 months ago | 0

| accepted

Question

How would these functions behave after compiling from GUI -> Executable?

I have designed a matlab gui (not with guide or appdesigner) and am interested in eventually compiling it into an executable fil...

4 months ago | 0 answers | 0

Answered

animate for a given time

tic toc is used to see how long processes take in your script. This is not relevant to what you are trying to do. You should ta...

animate for a given time

tic toc is used to see how long processes take in your script. This is not relevant to what you are trying to do. You should ta...

4 months ago | 0

Answered

index in matrix using loop

m = [0.5 0.5; 0.25 0.5; -0.5 -0.5] % your sample matrix f = m(m>0) * A + fill c = m(m<0) *A + cut ^ this only return the va...

index in matrix using loop

m = [0.5 0.5; 0.25 0.5; -0.5 -0.5] % your sample matrix f = m(m>0) * A + fill c = m(m<0) *A + cut ^ this only return the va...

4 months ago | 0

Answered

I am having problems in anonymous function (y=@(x)(...))

let me know if this is what youre trying to do with your anon functions: function y = fun(a,x) y = sum(triu(repmat(flip(x.^(1...

I am having problems in anonymous function (y=@(x)(...))

let me know if this is what youre trying to do with your anon functions: function y = fun(a,x) y = sum(triu(repmat(flip(x.^(1...

4 months ago | 0

Answered

Plot is not working

Your T is a vector, and your Y is a scalar. There is no singular line because it is actually plotting all 5 points as individual...

Plot is not working

Your T is a vector, and your Y is a scalar. There is no singular line because it is actually plotting all 5 points as individual...

4 months ago | 0

| accepted

Answered

why nothing is happening when i am calling other function in other button?

what is supposed to be happening? My guess is that something IS happening, except your callback functions are not returning anyt...

why nothing is happening when i am calling other function in other button?

what is supposed to be happening? My guess is that something IS happening, except your callback functions are not returning anyt...

4 months ago | 0

Answered

GUI Ignoring Changes to figure.Pointer Without a pause() command

add in a drawnow() command after you change the cursor.

GUI Ignoring Changes to figure.Pointer Without a pause() command

add in a drawnow() command after you change the cursor.

5 months ago | 0

| accepted

Answered

Calling function with set parameters

You can put all those graphic objects into an array, same for the strings and other parameters. then use a forloop. short examp...

Calling function with set parameters

You can put all those graphic objects into an array, same for the strings and other parameters. then use a forloop. short examp...

5 months ago | 0

| accepted

Answered

Filtering matlab table like a database or via dropdown menu

Yes! I would suggest creating the gui through uicontrol() programmatically (not via GUIDE): https://www.mathworks.com/help/matl...

Filtering matlab table like a database or via dropdown menu

Yes! I would suggest creating the gui through uicontrol() programmatically (not via GUIDE): https://www.mathworks.com/help/matl...

5 months ago | 0

| accepted

Answered

Photo and Text with Dropdown Menu

use uicontrol to create a text box: https://www.mathworks.com/help/matlab/ref/uicontrol.html and imshow to create your image: ...

Photo and Text with Dropdown Menu

use uicontrol to create a text box: https://www.mathworks.com/help/matlab/ref/uicontrol.html and imshow to create your image: ...

5 months ago | 0

Answered

How do I create a call back function that updates a "Label" when I push a button? (Calculator)

assign a tag to your label, which I assume is a text graphic object. example: txt1.Tag = 'label1'; function button_1callbac...

How do I create a call back function that updates a "Label" when I push a button? (Calculator)

assign a tag to your label, which I assume is a text graphic object. example: txt1.Tag = 'label1'; function button_1callbac...

5 months ago | 1

Answered

How can I share data from a uitable into the workspace of a timer function that reruns periodically?

sounds like maybe the handle for your uitable is out of the scope of the function. Etiher pass it as an input, or assign a tag t...

How can I share data from a uitable into the workspace of a timer function that reruns periodically?

sounds like maybe the handle for your uitable is out of the scope of the function. Etiher pass it as an input, or assign a tag t...

5 months ago | 1

| accepted