Answered

Redirect command window messages to GUI window

You can definitely do that. A small window and then keep on using 'set' to update that. However, when you say that there is n...

Redirect command window messages to GUI window

You can definitely do that. A small window and then keep on using 'set' to update that. However, when you say that there is n...

10 years ago | 1

Answered

Creating animation of signals from vectors of different points.

you can use drawnow and pause(0.1) in a loop. For example: x = 1:20; y = 1:20; [X, Y] = meshgrid(x,y); for j = ...

Creating animation of signals from vectors of different points.

you can use drawnow and pause(0.1) in a loop. For example: x = 1:20; y = 1:20; [X, Y] = meshgrid(x,y); for j = ...

10 years ago | 0

Answered

constrained maximization, share variables of tagret function and constraint

Yes. You can. You can use nested functions to utilize g(x) without calculating twice. Nested functions share the variable. Se...

constrained maximization, share variables of tagret function and constraint

Yes. You can. You can use nested functions to utilize g(x) without calculating twice. Nested functions share the variable. Se...

10 years ago | 0

| accepted

Answered

How to stretch a 1-D signal over the axes

If you mean just making the limits same for both plots, you can just multiply the whole x-axis of your output signal with someth...

How to stretch a 1-D signal over the axes

If you mean just making the limits same for both plots, you can just multiply the whole x-axis of your output signal with someth...

10 years ago | 0

Answered

Three element vector function?

function r = myfunc(x) r = x(:,1).^2 + x(:,2).^2 - x(:,3).^2 ;

Three element vector function?

function r = myfunc(x) r = x(:,1).^2 + x(:,2).^2 - x(:,3).^2 ;

10 years ago | 0

| accepted

Answered

How can I plot a simple circle not centered at the origin? example: (x-5)^2+(y-10)^2=4

You make a function for plotting the circle, something like this: * EDIT:* function plotcircle(x1,y1,r,c) % x1,y...

How can I plot a simple circle not centered at the origin? example: (x-5)^2+(y-10)^2=4

You make a function for plotting the circle, something like this: * EDIT:* function plotcircle(x1,y1,r,c) % x1,y...

10 years ago | 1

| accepted

Answered

How can I nest two loops of different dimension without using a for loop?

phi = 0.1; % Undefined n = 1:365; delta = sind(360*n); h = 11:-1:-12; a= cos(bsxfun(@times,cosd(delta),sind(15*h)'...

How can I nest two loops of different dimension without using a for loop?

phi = 0.1; % Undefined n = 1:365; delta = sind(360*n); h = 11:-1:-12; a= cos(bsxfun(@times,cosd(delta),sind(15*h)'...

10 years ago | 0

| accepted

Answered

cut character from string

ss1 = ss(1:2); ss2 = ss(3:4); In matlab strings are vectors of type char. So you can use indexing.

cut character from string

ss1 = ss(1:2); ss2 = ss(3:4); In matlab strings are vectors of type char. So you can use indexing.

10 years ago | 1

| accepted

Question

Is the start up time in compiled applications using 2013b better?

I had been been using Matlab 2012b. I had few deployed application using this version which took significant time to load up. ...

10 years ago | 1 answer | 2

Answered

Defining a variable based on input

If that is what you want, try eval doc eval However, you can skip making each variable with a new name and try cell or s...

Defining a variable based on input

If that is what you want, try eval doc eval However, you can skip making each variable with a new name and try cell or s...

10 years ago | 0

| accepted

Answered

Passing variables in a GUI

This is because fun1 and fun2 do not know the existence of handles inside that function. You can try something like this: ...

Passing variables in a GUI

This is because fun1 and fun2 do not know the existence of handles inside that function. You can try something like this: ...

10 years ago | 0

Answered

grouping measures by time

Your cell column 1 and 2 represent date and time. you can use datenum to determine time difference. for example (assuming you c...

grouping measures by time

Your cell column 1 and 2 represent date and time. you can use datenum to determine time difference. for example (assuming you c...

10 years ago | 0

Answered

How do I find values at geographic coordinates in a matrix?

I think interpolation will be the route. You can use interp2. For the example here, R_int = interp2(X,Y,R,Ax,Ay);

How do I find values at geographic coordinates in a matrix?

I think interpolation will be the route. You can use interp2. For the example here, R_int = interp2(X,Y,R,Ax,Ay);

10 years ago | 0

| accepted

Answered

showing error like Attempt to reference field of non-structure array?/

d=0:10:40; r=0.5; q1=2.65; E0=8.85*10^-12; E1=60; b1 =(d./r).^(2/3); E2=E1./b1; E3= E2.*(d+r).^2/(...

showing error like Attempt to reference field of non-structure array?/

d=0:10:40; r=0.5; q1=2.65; E0=8.85*10^-12; E1=60; b1 =(d./r).^(2/3); E2=E1./b1; E3= E2.*(d+r).^2/(...

10 years ago | 0

Answered

Define a variable via inputdlg?

row = inputdlg('Insert row number.'); row = str2num(row{:});

Define a variable via inputdlg?

row = inputdlg('Insert row number.'); row = str2num(row{:});

10 years ago | 0

| accepted

Answered

index exceeds matix error

(mesh.nodes(:,1:3)-repmat(coord(i,1:3),size(mesh.nodes(:,1:3),1),1)).^2; The code should work unless coord or mesh.nodes ha...

index exceeds matix error

(mesh.nodes(:,1:3)-repmat(coord(i,1:3),size(mesh.nodes(:,1:3),1),1)).^2; The code should work unless coord or mesh.nodes ha...

10 years ago | 0

Answered

set of ranges in vector.

minV = [2,20,70,90,120]; maxV = [5,25,80,100,130]; n = length(minV); %I dont want to store each value seperately. ...

set of ranges in vector.

minV = [2,20,70,90,120]; maxV = [5,25,80,100,130]; n = length(minV); %I dont want to store each value seperately. ...

10 years ago | 0

Answered

How to store "for loop" values?

h=11:-1:-12 for i = 1:length(h) beta=asind(cosd(Lat)*cosd(delta)*cosd(15*h(i))+sind(Lat)*sind(delta)) phi_s=asin...

How to store "for loop" values?

h=11:-1:-12 for i = 1:length(h) beta=asind(cosd(Lat)*cosd(delta)*cosd(15*h(i))+sind(Lat)*sind(delta)) phi_s=asin...

10 years ago | 1

| accepted

Answered

How to arrange plotted points in to a table?

If starting_w is vector, you can save the x,y values as myval = [starting_w opt_f(disc_w(starting_w),2,1)]

How to arrange plotted points in to a table?

If starting_w is vector, you can save the x,y values as myval = [starting_w opt_f(disc_w(starting_w),2,1)]

10 years ago | 0

Answered

Insert interval labels on plot

If you mean indicate intervals as legend then add this after the loop legend('w1','w2','w3','w4','w5','w6','w7');

Insert interval labels on plot

If you mean indicate intervals as legend then add this after the loop legend('w1','w2','w3','w4','w5','w6','w7');

10 years ago | 0

Answered

I need to set up a while loop to compute the projectileâ€™s range for gradually increasing velocities, starting at zero and increasing by 0.1m/s each time. But i have only studied FOR loops and i dont know how to do WHILE loops can someone help ?

just like for loop, you can use while true you code end

I need to set up a while loop to compute the projectileâ€™s range for gradually increasing velocities, starting at zero and increasing by 0.1m/s each time. But i have only studied FOR loops and i dont know how to do WHILE loops can someone help ?

just like for loop, you can use while true you code end

10 years ago | 0

| accepted

Answered

Looping With Transition Matrices

I don't know the process you're doing on D to make it equal to A. However with floating points, there can be carry over like 1.0...

Looping With Transition Matrices

I don't know the process you're doing on D to make it equal to A. However with floating points, there can be carry over like 1.0...

10 years ago | 0

Answered

The Flop (Floating Point Operations per Second) Rate of MATLAB Code

I don't think the way you're trying to calculate flops here is right. Even if one assumes that you can calculate Flops like this...

The Flop (Floating Point Operations per Second) Rate of MATLAB Code

I don't think the way you're trying to calculate flops here is right. Even if one assumes that you can calculate Flops like this...

10 years ago | 0

| accepted

Answered

How to access randomly selected index in nested structures

Try something like this: for i=1:n X = fieldnames(structName); n = length(X); fileName=structName(i).(X{rand...

How to access randomly selected index in nested structures

Try something like this: for i=1:n X = fieldnames(structName); n = length(X); fileName=structName(i).(X{rand...

10 years ago | 0

| accepted

Answered

How can we write the for loop for accessing a table data?

If Walter's interpretation is correct, then you do not need so many loops. A single loop approach will be: A = [5 15 25]; ...

How can we write the for loop for accessing a table data?

If Walter's interpretation is correct, then you do not need so many loops. A single loop approach will be: A = [5 15 25]; ...

10 years ago | 0

Answered

To find the minimum of a function which are constrained problems

Good that you tried it now. Lets see the problem again: You want to find minimum value for the expression, where P belongs to...

To find the minimum of a function which are constrained problems

Good that you tried it now. Lets see the problem again: You want to find minimum value for the expression, where P belongs to...

10 years ago | 0

| accepted

Answered

Is there the more elegant way to do this?

function testarg() a=1;b=2;c=3; abc(a,b,c) function abc(a,b,c) a b c This wil ldo just fine.

Is there the more elegant way to do this?

function testarg() a=1;b=2;c=3; abc(a,b,c) function abc(a,b,c) a b c This wil ldo just fine.

10 years ago | 1

Answered

save matrix....load matrix

You can save the variable as a mat file using something like this: save('saveA.mat','A'); To do the second step, you can...

save matrix....load matrix

You can save the variable as a mat file using something like this: save('saveA.mat','A'); To do the second step, you can...

10 years ago | 6

| accepted

Answered

Press a key to stop the program?

I think you can use this function from fileexchange: http://www.mathworks.com/matlabcentral/fileexchange/8297-getkeywait

Press a key to stop the program?

I think you can use this function from fileexchange: http://www.mathworks.com/matlabcentral/fileexchange/8297-getkeywait

10 years ago | 0

| accepted