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?

5年以上 前 | 1

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

5年以上 前 | 1

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

5年以上 前 | 1

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 2

| 採用済み

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

5年以上 前 | 0

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 0

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

5年以上 前 | 0

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

5年以上 前 | 0

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 1

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

5年以上 前 | 2

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

5年以上 前 | 1

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

5年以上 前 | 1

| 採用済み

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 0

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)

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 0

| 採用済み

tall array with sqlite3

5年以上 前 | 1

| 採用済み

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

5年以上 前 | 0

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

5年以上 前 | 1

| 採用済み

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

5年以上 前 | 0

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

5年以上 前 | 0

| 採用済み

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

5年以上 前 | 0

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

5年以上 前 | 0

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

5年以上 前 | 0

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

5年以上 前 | 1