Réponse apportée
Matrix Indexing
A = zeros(max(idx(:)),size(idx,1)); A(sub2ind(size(A),idx,cumsum(ones(size(idx))))) = 1

plus de 15 ans il y a | 2

| A accepté

Réponse apportée
Programming Snafu's - My Numerical Analysis HW
I would paste them into the MATLAB editor and read the warnings. Also, try to run the functions and see what happens! They wil...

plus de 15 ans il y a | 0

| A accepté

Réponse apportée
How do I write a good answer for MATLAB Answers?
Put a clarifying question in the "Comment on this Question" box instead of putting your question as an answer.

plus de 15 ans il y a | 4

Réponse apportée
How do I write a good answer for MATLAB Answers?
Ask the writer of an obvious homework question (especially when no work is shown) to: # Provide the work done so far (the code...

plus de 15 ans il y a | 2

Question


How do I write a good answer for MATLAB Answers?
Since the question, "How do I write a good question for MATLAB answers?" has been asked, I wondered if we could benefit from the...

plus de 15 ans il y a | 16 réponses | 16

16

réponses

Réponse apportée
How do I write a good question for MATLAB Answers?
Things I like to see in a question: # Clear explanation of the problem, current code included. If the current code doesn't wor...

plus de 15 ans il y a | 8

Réponse apportée
Declaring 'many' variables from work space into function workspace
Usually one should pass the variables in via the argument list. Other ways of making magic are generally frowned upon _with goo...

plus de 15 ans il y a | 12

Réponse apportée
Solving for log function
Use the FZERO function. What values do you have for R_1 and R_2? F = @(a) log(1/R_1).^a - log(1/R_2).^a rt = fzero(F,.1);...

plus de 15 ans il y a | 1

Question


What causes MATLAB to execute pasted code automatically?
Sometimes I will copy a piece of code that someone has put up in answer to a question, then paste the code into MATLAB at the co...

plus de 15 ans il y a | 3 réponses | 2

3

réponses

Réponse apportée
Which MATLAB function can remove the diagonal elements of a NxN matrix
Your example doesn't add up, as Kenneth mentioned. However, in general you could do something like this: A = [ 0 1 2 3 1 ...

plus de 15 ans il y a | 6

| A accepté

Réponse apportée
Matrix Indexing
Another alternative: A = zeros(1,t_off(end)+1); A(t_on) = 1; A(t_off+1) = -1; A = cumsum(A(1:t_off(end)));

plus de 15 ans il y a | 4

| A accepté

Réponse apportée
Matrix Indexing
Bruno's MCOLON function may be what you need. <http://www.mathworks.com/matlabcentral/fileexchange/29854-multiple-colon> A...

plus de 15 ans il y a | 1

Réponse apportée
MATLAB GUI
UITABLE was available in 2007a, for example: T = uitable('NumColumns',4,'NumRows',6,'position',[10 10 400 300]); Now to see ...

plus de 15 ans il y a | 0

Réponse apportée
Insert a matrix within a matrix
Assuming you meant x = [a,b;c,d]; then y = blkdiag(x,x)

plus de 15 ans il y a | 5

Réponse apportée
Selecting words in MATLAB
You don't say how the words are divided, or even what kind of selection is to be made. However, I will assume you have three ce...

plus de 15 ans il y a | 3

Réponse apportée
MATLAB GUI
Would UITABLE be what you want?

plus de 15 ans il y a | 0

Réponse apportée
multiplying certain parts of an 8x8 matrix
M = magic(8) S = sum(M([1 8 57 64 28 29 36 37]))

plus de 15 ans il y a | 2

Réponse apportée
controlling background color of selected uicontrol popup?
Things seem to work here as you wish, unless I misunderstand you. uicontrol('Style','popup','backgroundcol',[.9 .7 .3],'str...

plus de 15 ans il y a | 1

Réponse apportée
Yaxis invisible
I don't think there is a way of doing it directly. Here is a hackey way of getting what you want for the Y-axis. Do similar fo...

plus de 15 ans il y a | 1

Réponse apportée
How do I generate a vector of random integers without repeats and with j+2 constraints?
Some of your constraints would seem to be exclusive at first read. Here is an attempt at all 5: N = [1 2 3 5 6 7 8 9]; ...

plus de 15 ans il y a | 0

Réponse apportée
How do I find the number of character in a text file?
fid = fopen('inp.txt'); % see also fclose A = char(fread(fid,inf)).'; A = banerjee.raktim 123456789125 >> length(A) ...

plus de 15 ans il y a | 1

| A accepté

Réponse apportée
How do I access an Invalid-named variable from an exported MAT file that MATLAB will not recognize?
Give this a try. What is the extension of the data file? X = load('01_ExportData') % May need the extension D = struct2ce...

plus de 15 ans il y a | 0

Réponse apportée
How do I use randperm to produce a completely new sequence (no numbers in same place)?
Or, perhaps more efficient even: function As = mix2(A) T = A(randperm(length(A))).'; As = zeros(length(A)); As(:,1) = T...

plus de 15 ans il y a | 1

Réponse apportée
How do I use randperm to produce a completely new sequence (no numbers in same place)?
O.k., I see I misread the requirements. You want no two elements to be equal, correct? This should work too, if A is not reall...

plus de 15 ans il y a | 1

Réponse apportée
How do I use randperm to produce a completely new sequence (no numbers in same place)?
You could do this with the PERMS function. A = [4 2 5 1 3]; % Sample code T = perms(A); B = randperm(size(T,1)); ...

plus de 15 ans il y a | 0

Réponse apportée
Binary string to character string?
userid = char(bin2dec(reshape(watermark(1:160),[],8))).' passwrd = char(bin2dec(reshape(watermark(161:320),[],8))).' str =...

plus de 15 ans il y a | 1

| A accepté

Réponse apportée
How do you randomize numbers but not have two consecutive numbers be the same?
Use the RANDPERM function. Depending on what you want to do, pick one of these: >> A = [1 2;3 4;5 6;7 8;9 10] % Sample Data...

plus de 15 ans il y a | 2

Réponse apportée
Uniform distribution of N points within a sphere
Here is another solution which converts to Cartesian coordinates, though it does call the trig functions. function [x,...

plus de 15 ans il y a | 1

Réponse apportée
Define a function for a system using Symbolic Math Toolbox
What use could an undefined function be? If you want your function to return nothing, then: y = @(t) []; would do the t...

plus de 15 ans il y a | 1

Réponse apportée
Gradient and NaN
You can see what MATLAB does by looking at a plot. Look at the difference between the two figures: v = -2:0.5:2; ...

plus de 15 ans il y a | 0

Charger plus