Respondida
Finding a value in a column from a change in another column in a matrix?
ind = X(:,3) == 3.0 & [abs(abs(diff(X(:,3))) - 1e-4) < 1e-10; 0] X(ind,1) or ind = X(1:end-1,3) == 3.0 & X(2:end...

más de 10 años hace | 0

| aceptada

Respondida
hello everyone,i have another problem in inserting & extracting data in matlab. can you check please?
C = {{1}, {2}, []; [], {1,2}, {3}};

más de 10 años hace | 1

| aceptada

Respondida
How to I find a x value from a given y?
x(y==yourvalue) or if you allow for some tolerance tol = 1e-6; x(abs(y-yourvalue) < tol)

más de 10 años hace | 7

| aceptada

Respondida
Error using - Matrix dimensions must agree. Error in WDO_SG_Code_PL_test1m (line 322) a2=aa-a1; i got the error my code segment is below can any one help me why this error came?
Check the sizes by adding whos aa whos a1 before the a2=aa-a1; line. aa and a1 must have the same size, otherwise ...

más de 10 años hace | 0

Respondida
hello every one ...i need program for clock..or for e.g need code to write clock
To show the current date and time, use datestr(now) If you want to measure the time, you can use tic; toc or clock and e...

más de 10 años hace | 1

Respondida
getting the coordinates of green colored portion.
If you have matrix X of zeros and ones, where the ones mark the the pixels of the green object, you can extract its x and y coor...

más de 10 años hace | 0

Respondida
How to comparison decimal numbers
You can round to 5 decimal places using xr = round(x*1e5)/1e5; You may want to set format long such that the res...

más de 10 años hace | 0

Respondida
replace elements in columns of a matrix
This is the best I can think of A = rand(1e5, 1); B = rand(1e5, 1); res = nan(size(A)); for i = 1:numel(A) ...

más de 10 años hace | 1

| aceptada

Respondida
Convert binary values to a decimal matrix
aback = reshape(bin2dec(num2str(reshape(e, 4, []))), 2, 2);

más de 10 años hace | 1

| aceptada

Respondida
generating a randon vector withou repeating any number
x = randperm(18, 17);

más de 10 años hace | 1

Respondida
Am i correct with my conversion of a Logical indexing to a for loop?
for i = find(T > 10) T(i) = 10; end

más de 10 años hace | 0

Respondida
Write MATLAB code to create and print a vector GS that stores the first 10 terms of the geometric sequence that halves each time: {1/2, 1/4, 1/8, 1/16, ... 1/1024 }
Initial=input('Enter initial value: ') y(1) = Initial*0.5; for i = 2:10 y(i)= y(i-1)*0.5 end or following St...

más de 10 años hace | 0

Respondida
Account delete How to?
Contact Mathworks Support.

más de 10 años hace | 1

Respondida
What is the problem with the following sin approximation?
The formula is wrong. It's (-1)^(n)*x.^(2*n+1)/factorial(2*n+1) for the n'th term. Instead of your solution using X1 and X2, you...

más de 10 años hace | 4

Respondida
array assignment with and without semicolon
The problem is when a and b change such that the number of elements in a:b change. If you have, say, n elements in a:b for the f...

más de 10 años hace | 0

| aceptada

Respondida
Error 'undefined function or variable' occurs even when the variable is defined
You should define your function basis1 in terms of its parameters x1, x2, x3, like function [u1]=basis1(x1, x2, x3) u1 =...

más de 10 años hace | 0

Respondida
How to run multiple for loops for values of x up to y and then from y up to z.
You don't need loops. Use logical indices instead: b = 10; x = linspace(0,b,1000); ind = x < a; y(ind) = x(ind).^2; %...

más de 10 años hace | 0

Respondida
Does Matlab uses the same seed generated by the main function for the functions that are called by that function? Results changed!!
Matlab uses a single random number generator for RAND, RANDI, and RANDN, for the command line or in called function. Setting a s...

más de 10 años hace | 0

Respondida
Merge two columns into one column?
C = 10.^ceil(log10(B)).*A + B;

más de 10 años hace | 0

| aceptada

Respondida
While loop runs infinitely
The code for approximation is wrong. There are some errors in your formula: term takes values 0, 2, 4, ... but should take value...

más de 10 años hace | 0

| aceptada

Respondida
how to use if else of for loops to manipulate matrices
To get all values from column 1 of X, where column 2 is > 3.4: x = X(X(:,2) > 3.4, 1);

más de 10 años hace | 0

| aceptada

Respondida
Create a Matrix with a specific main diagonal
val = 50; N = 10; X = diag(repmat(val-1, 1, 10)) + ones(N)

más de 10 años hace | 1

| aceptada

Respondida
how to put the image that is sky background in the 3D axes in plot
You can show an image in 3D using surf I = imread('cameraman.tif'); [X Y] = meshgrid(1:size(I,1), fliplr(1:size(I,2))); ...

más de 10 años hace | 0

Respondida
half the first NaN value after the last non NaN value in each column
ind = diff(isnan([p; p(end,:)])) == 1; p(ind) = p(ind)/2;

más de 10 años hace | 0

Respondida
How can I found the distance SSD (Sum of Squared Differences) between two images ?
X = I1 - I2; ssd = sum(X(:).^2);

más de 10 años hace | 4

| aceptada

Respondida
I am new to Matlab. Can anyone explain how I get this simple prog to run on my mac?
a=[1 -3 2 5]; try %Try to display an element index = input('Enter subscript of element to display: '); disp(['...

más de 10 años hace | 0

Respondida
Remove units from a string
s = '1.25ns'; v = sscanf(s, '%f')

más de 10 años hace | 0

| aceptada

Respondida
How do I plot a line of a fixed length and slope?
slope = 120/180*pi; length = 10; dx = 10; dy = -20; line([-length/2*cos(slope) length/2*cos(slope)]+dx, [-length/2*sin(slope...

más de 10 años hace | 0

Cargar más