Answered

How much is (in kms) 1 degree of Longitude in the Earth?

<https://se.mathworks.com/help/map/ref/deg2km.html> Or perhaps: <https://se.mathworks.com/help/map/ref/stdist.html> pro...

How much is (in kms) 1 degree of Longitude in the Earth?

<https://se.mathworks.com/help/map/ref/deg2km.html> Or perhaps: <https://se.mathworks.com/help/map/ref/stdist.html> pro...

más de 2 años ago | 0

Answered

Write a program that will find the smallest number that is divisible (without remainder) of each of the numbers 1 to 10.

disp('2520') Or did you expect people to do your homework?

Write a program that will find the smallest number that is divisible (without remainder) of each of the numbers 1 to 10.

disp('2520') Or did you expect people to do your homework?

más de 2 años ago | 1

Answered

I have Matlab r2009a and I am trying to use MEX with Visual Studio 2010 but Matlab can't find the compiler. Is there a way to do this?

Think two seconds about that. You are asking a program that came out in 2009 to use a compiler that came out in 2010. Haven't ac...

I have Matlab r2009a and I am trying to use MEX with Visual Studio 2010 but Matlab can't find the compiler. Is there a way to do this?

Think two seconds about that. You are asking a program that came out in 2009 to use a compiler that came out in 2010. Haven't ac...

más de 2 años ago | 1

Answered

Delete rows when a value repeated less than 5 times

idx = unique(m(:,3)); count = accumarray(c.',(1:numel(c)).',[],@numel); to_keep = ~ismember(m(:,3),idx(count < 5)); r...

Delete rows when a value repeated less than 5 times

idx = unique(m(:,3)); count = accumarray(c.',(1:numel(c)).',[],@numel); to_keep = ~ismember(m(:,3),idx(count < 5)); r...

más de 2 años ago | 1

Answered

How to apply colourmap onto shapes

radius = 2; c_x = 1; c_y = 1; numElem = 100; x = linspace(0,2*pi,numElem); y = x; x = radius.*co...

How to apply colourmap onto shapes

radius = 2; c_x = 1; c_y = 1; numElem = 100; x = linspace(0,2*pi,numElem); y = x; x = radius.*co...

más de 2 años ago | 0

| accepted

Answered

Average wind speed histogram

t1 = datetime(2016,6,1,0,30,0); t2 = datetime(2017,5,31,23,30,0); t = t1:minutes(30):t2; wind_dir = randi...

Average wind speed histogram

t1 = datetime(2016,6,1,0,30,0); t2 = datetime(2017,5,31,23,30,0); t = t1:minutes(30):t2; wind_dir = randi...

más de 2 años ago | 0

| accepted

Answered

How to change color from a .fig file having subplots

Creating figure and forgetting all handles: for ii = 1:2 subplot(1,2,ii); plot(1:10,sort(rand(10))); end ...

How to change color from a .fig file having subplots

Creating figure and forgetting all handles: for ii = 1:2 subplot(1,2,ii); plot(1:10,sort(rand(10))); end ...

más de 2 años ago | 1

| accepted

Answered

Superimposed multiple different Surface on Same plot ?

[X,Y,Z] = peaks(25); floor_space = 10; %First floor surf(X,Y,Z); hold on %Second floor surf(X,Y,Z + floor_s...

Superimposed multiple different Surface on Same plot ?

[X,Y,Z] = peaks(25); floor_space = 10; %First floor surf(X,Y,Z); hold on %Second floor surf(X,Y,Z + floor_s...

más de 2 años ago | 0

Answered

How to get the smallest difference(Array)

bla = randi(50,10); val = 25; result = abs(bla-val); result = result == min(result(:)); [xx,yy] = ndgrid(1:siz...

How to get the smallest difference(Array)

bla = randi(50,10); val = 25; result = abs(bla-val); result = result == min(result(:)); [xx,yy] = ndgrid(1:siz...

más de 2 años ago | 0

| accepted

Answered

how to run various steps in loop with conditions?

What's wrong with a while loop? condition = True; while condition %do your thing condition = something...

how to run various steps in loop with conditions?

What's wrong with a while loop? condition = True; while condition %do your thing condition = something...

más de 2 años ago | 0

Answered

Average wind speed histogram

You could adapt a rose plot to your need. It is the "standard" way of showing wind direction distributions. <https://se.mathw...

Average wind speed histogram

You could adapt a rose plot to your need. It is the "standard" way of showing wind direction distributions. <https://se.mathw...

más de 2 años ago | 0

Answered

How to create curve in a plot scatter figure?

Convoluted way just to avoid repeating Steven's answer: data = randn(5000,2); %First column xData, second column yData ...

How to create curve in a plot scatter figure?

Convoluted way just to avoid repeating Steven's answer: data = randn(5000,2); %First column xData, second column yData ...

más de 2 años ago | 0

Answered

Compare some parts from one row in two matrices

K_sub = K(:,[1,end]); L_sub = L(:,[1,end]) [ii,kk] = size(L_sub); L_sub=reshape(L_sub',[1,kk,ii]); result = squeez...

Compare some parts from one row in two matrices

K_sub = K(:,[1,end]); L_sub = L(:,[1,end]) [ii,kk] = size(L_sub); L_sub=reshape(L_sub',[1,kk,ii]); result = squeez...

más de 2 años ago | 0

| accepted

Answered

write a matrix from a function (say h(m,n), where m and n are running index)

myFun = @(x,y) x.^2 + y; result = bsxfun(myFun,1:3,(1:3).') If I understood your question right, then you'd just need to...

write a matrix from a function (say h(m,n), where m and n are running index)

myFun = @(x,y) x.^2 + y; result = bsxfun(myFun,1:3,(1:3).') If I understood your question right, then you'd just need to...

más de 2 años ago | 1

Answered

How can I create series of equations to graph, that might have a different number of equations every time, without using dynamic variable naming?

You can place function handles in cell arrays: funArray = cell(2,1); funArray{1} = @(x) x.^2; funArray{2} = @(x) 3.*x...

How can I create series of equations to graph, that might have a different number of equations every time, without using dynamic variable naming?

You can place function handles in cell arrays: funArray = cell(2,1); funArray{1} = @(x) x.^2; funArray{2} = @(x) 3.*x...

más de 2 años ago | 1

Answered

How to find index of a minimum value starting from the end

A = randi(10,10); A_min = min(A,[],2); dummy = bsxfun(@eq,A,A_min); dummy = bsxfun(@times,dummy,1:size(A,2)); resu...

How to find index of a minimum value starting from the end

A = randi(10,10); A_min = min(A,[],2); dummy = bsxfun(@eq,A,A_min); dummy = bsxfun(@times,dummy,1:size(A,2)); resu...

más de 2 años ago | 1

| accepted

Answered

How to look for minimum value in a vector from backwards?

A = [5 6 4 1 1 1]; A_min = min(A); idx = find(A == A_min,1,'last') Also [A_min,idx] = min(fliplr(A)); idx = ...

How to look for minimum value in a vector from backwards?

A = [5 6 4 1 1 1]; A_min = min(A); idx = find(A == A_min,1,'last') Also [A_min,idx] = min(fliplr(A)); idx = ...

más de 2 años ago | 0

| accepted

Answered

Error using ga (line 283) - Matlab newbie

_fitnessfcn_ should be a function handle. It doesn't look like that's what you are passing. fitnessfcn = @(x) x.^2; For e...

Error using ga (line 283) - Matlab newbie

_fitnessfcn_ should be a function handle. It doesn't look like that's what you are passing. fitnessfcn = @(x) x.^2; For e...

más de 2 años ago | 0

Answered

how to average num of column for each row?

Taking your question literally would yield: dummy = rand(972,215); result = mean(dummy,2) ./ size(dummy,2)

how to average num of column for each row?

Taking your question literally would yield: dummy = rand(972,215); result = mean(dummy,2) ./ size(dummy,2)

más de 2 años ago | 0

| accepted

Answered

Can I only declare a variable NOT define.

No. Different paradigm. Matlab is weakly typed. Double is the default type. Implicit conversions everywhere. dummy = '3' * 5...

Can I only declare a variable NOT define.

No. Different paradigm. Matlab is weakly typed. Double is the default type. Implicit conversions everywhere. dummy = '3' * 5...

más de 2 años ago | 0

| accepted

Answered

tall array with sqlite3

Save yourself a headache and use <https://se.mathworks.com/help/database/ug/sqlite-object.html _sqlite()_> instead. Otherwise...

tall array with sqlite3

Save yourself a headache and use <https://se.mathworks.com/help/database/ug/sqlite-object.html _sqlite()_> instead. Otherwise...

más de 2 años ago | 1

| accepted

Answered

How to insert an element into matrix?

result = [A;B] Or use <https://se.mathworks.com/help/matlab/ref/cat.html cat()>

How to insert an element into matrix?

result = [A;B] Or use <https://se.mathworks.com/help/matlab/ref/cat.html cat()>

más de 2 años ago | 0

Answered

Invert or reverse Yaxis ticks in a plot or scatter graph

x=1:10; y=[0.4 0.61 0.45 0.66 0.41 0.63 0.44 0.62 0.46 0.6]; aH = axes; scatter(aH,x,y,'filled','bo'); aH.YDir = '...

Invert or reverse Yaxis ticks in a plot or scatter graph

x=1:10; y=[0.4 0.61 0.45 0.66 0.41 0.63 0.44 0.62 0.46 0.6]; aH = axes; scatter(aH,x,y,'filled','bo'); aH.YDir = '...

más de 2 años ago | 1

| accepted

Answered

How to run a function each certain amount of time during loop?

Looks like you need a timer object inside your function. <https://se.mathworks.com/help/matlab/matlab_prog/use-a-matlab-timer...

How to run a function each certain amount of time during loop?

Looks like you need a timer object inside your function. <https://se.mathworks.com/help/matlab/matlab_prog/use-a-matlab-timer...

más de 2 años ago | 0

Answered

How to plot data of 3 columns with different line style.

Best to do it explicitly for each line, but if you want automagic: set(groot,'defaultAxesColorOrder',[0,0,0],'defaultAxesLi...

How to plot data of 3 columns with different line style.

Best to do it explicitly for each line, but if you want automagic: set(groot,'defaultAxesColorOrder',[0,0,0],'defaultAxesLi...

más de 2 años ago | 0

| accepted

Answered

MatLab C++ Shared Dll library initialization problem

<https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016b_Supporte...

MatLab C++ Shared Dll library initialization problem

<https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016b_Supporte...

más de 2 años ago | 0

Answered

How to calculate maximum up to current point?

a = [3,8,10,6,5,11,12,-20]; n = numel(a); result = tril(bsxfun(@minus,a,a')); [~,idx] = max(result,[],2); resu...

How to calculate maximum up to current point?

a = [3,8,10,6,5,11,12,-20]; n = numel(a); result = tril(bsxfun(@minus,a,a')); [~,idx] = max(result,[],2); resu...

más de 2 años ago | 0

Answered

Extracting elements from a matrix based on the maximum position in another matrix

a = rand(100,96); b = rand(100,96); [~,idx] = max(b); result = a(sub2ind(idx,1:size(a,2)))

Extracting elements from a matrix based on the maximum position in another matrix

a = rand(100,96); b = rand(100,96); [~,idx] = max(b); result = a(sub2ind(idx,1:size(a,2)))

más de 2 años ago | 0