Respondida
Matrix Indexing
A = zeros(max(idx(:)),size(idx,1)); A(sub2ind(size(A),idx,cumsum(ones(size(idx))))) = 1

casi 16 años hace | 2

| aceptada

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

casi 16 años hace | 0

| aceptada

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

casi 16 años hace | 4

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

casi 16 años hace | 2

Pregunta


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

casi 16 años hace | 16 respuestas | 16

16

respuestas

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

casi 16 años hace | 8

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

casi 16 años hace | 12

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

casi 16 años hace | 1

Pregunta


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

casi 16 años hace | 3 respuestas | 2

3

respuestas

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

casi 16 años hace | 6

| aceptada

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

casi 16 años hace | 4

| aceptada

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

casi 16 años hace | 1

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

casi 16 años hace | 0

Respondida
Insert a matrix within a matrix
Assuming you meant x = [a,b;c,d]; then y = blkdiag(x,x)

casi 16 años hace | 5

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

casi 16 años hace | 3

Respondida
MATLAB GUI
Would UITABLE be what you want?

casi 16 años hace | 0

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

casi 16 años hace | 2

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

casi 16 años hace | 1

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

casi 16 años hace | 1

Respondida
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]; ...

casi 16 años hace | 0

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

casi 16 años hace | 1

| aceptada

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

casi 16 años hace | 0

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

casi 16 años hace | 1

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

casi 16 años hace | 1

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

casi 16 años hace | 0

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

casi 16 años hace | 1

| aceptada

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

casi 16 años hace | 2

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

casi 16 años hace | 1

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

casi 16 años hace | 1

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

casi 16 años hace | 0

Cargar más