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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 7

| akzeptiert

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 1

| akzeptiert

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

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

Beantwortet
Account delete How to?
Contact Mathworks Support.

mehr als 10 Jahre vor | 1

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

mehr als 10 Jahre vor | 4

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

Beantwortet
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; %...

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 1

| akzeptiert

Beantwortet
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))); ...

mehr als 10 Jahre vor | 0

Beantwortet
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;

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 4

| akzeptiert

Beantwortet
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(['...

mehr als 10 Jahre vor | 0

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

mehr als 10 Jahre vor | 0

| akzeptiert

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

mehr als 10 Jahre vor | 0

Mehr laden