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

oltre 15 anni fa | 2

| accettato

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

oltre 15 anni fa | 0

| accettato

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

oltre 15 anni fa | 4

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

oltre 15 anni fa | 2

Domanda


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

oltre 15 anni fa | 16 risposte | 16

16

risposte

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

oltre 15 anni fa | 8

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

oltre 15 anni fa | 12

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

oltre 15 anni fa | 1

Domanda


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

oltre 15 anni fa | 3 risposte | 2

3

risposte

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

oltre 15 anni fa | 6

| accettato

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

oltre 15 anni fa | 4

| accettato

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 0

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

oltre 15 anni fa | 5

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

oltre 15 anni fa | 3

Risposto
MATLAB GUI
Would UITABLE be what you want?

oltre 15 anni fa | 0

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

oltre 15 anni fa | 2

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 0

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

oltre 15 anni fa | 1

| accettato

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

oltre 15 anni fa | 0

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 0

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

oltre 15 anni fa | 1

| accettato

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

oltre 15 anni fa | 2

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 1

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

oltre 15 anni fa | 0

Carica altro