Respondida
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 6 años hace | 1

Respondida
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 6 años hace | 1

Respondida
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 6 años hace | 1

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 2

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 1

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

más de 6 años hace | 3

Respondida
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 6 años hace | 1

Respondida
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 6 años hace | 1

| aceptada

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 1

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 1

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

| aceptada

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

Respondida
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 6 años hace | 0

Respondida
How to build a matrix like this
n = 4; result = repmat((n:-1:1),n,1) - tril(cumsum(tril(ones(n)))-1)

más de 6 años hace | 1

Cargar más