Réponse apportée
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...

environ 10 ans il y a | 0

| A accepté

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

environ 10 ans il y a | 1

| A accepté

Réponse apportée
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)

plus de 10 ans il y a | 7

| A accepté

Réponse apportée
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 ...

plus de 10 ans il y a | 0

Réponse apportée
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...

plus de 10 ans il y a | 1

Réponse apportée
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...

plus de 10 ans il y a | 0

Réponse apportée
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...

plus de 10 ans il y a | 0

Réponse apportée
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) ...

plus de 10 ans il y a | 1

| A accepté

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

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
generating a randon vector withou repeating any number
x = randperm(18, 17);

plus de 10 ans il y a | 1

Réponse apportée
Am i correct with my conversion of a Logical indexing to a for loop?
for i = find(T > 10) T(i) = 10; end

plus de 10 ans il y a | 0

Réponse apportée
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...

plus de 10 ans il y a | 0

Réponse apportée
Account delete How to?
Contact Mathworks Support.

plus de 10 ans il y a | 1

Réponse apportée
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...

plus de 10 ans il y a | 4

Réponse apportée
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...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
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 =...

plus de 10 ans il y a | 0

Réponse apportée
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; %...

plus de 10 ans il y a | 0

Réponse apportée
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...

plus de 10 ans il y a | 0

Réponse apportée
Merge two columns into one column?
C = 10.^ceil(log10(B)).*A + B;

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
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);

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
Create a Matrix with a specific main diagonal
val = 50; N = 10; X = diag(repmat(val-1, 1, 10)) + ones(N)

plus de 10 ans il y a | 1

| A accepté

Réponse apportée
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))); ...

plus de 10 ans il y a | 0

Réponse apportée
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;

plus de 10 ans il y a | 0

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

plus de 10 ans il y a | 4

| A accepté

Réponse apportée
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(['...

plus de 10 ans il y a | 0

Réponse apportée
Remove units from a string
s = '1.25ns'; v = sscanf(s, '%f')

plus de 10 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 10 ans il y a | 0

Charger plus