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

quasi 7 anni fa | 0

Risposto
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?

quasi 7 anni fa | 1

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

quasi 7 anni fa | 1

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

quasi 7 anni fa | 1

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

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 2

| accettato

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

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 1

Risposto
How to check a number is in a array or not?
sum(a==5) > 0 any(a==5)

quasi 7 anni fa | 3

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

quasi 7 anni fa | 1

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

quasi 7 anni fa | 1

| accettato

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

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 0

Risposto
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)

quasi 7 anni fa | 0

| accettato

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

quasi 7 anni fa | 0

| accettato

Risposto
tall array with sqlite3

quasi 7 anni fa | 1

| accettato

Risposto
How to insert an element into matrix?
result = [A;B] Or use <https://se.mathworks.com/help/matlab/ref/cat.html cat()>

quasi 7 anni fa | 0

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

quasi 7 anni fa | 1

| accettato

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

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

| accettato

Risposto
MatLab C++ Shared Dll library initialization problem
<https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release2016b_Supporte...

quasi 7 anni fa | 0

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

quasi 7 anni fa | 0

Risposto
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)))

quasi 7 anni fa | 0