回答済み
Matrix Indexing
A = zeros(max(idx(:)),size(idx,1)); A(sub2ind(size(A),idx,cumsum(ones(size(idx))))) = 1

15年以上 前 | 2

| 採用済み

回答済み
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...

15年以上 前 | 0

| 採用済み

回答済み
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.

15年以上 前 | 4

回答済み
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...

15年以上 前 | 2

質問


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

15年以上 前 | 16 件の回答 | 16

16

回答

回答済み
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...

15年以上 前 | 8

回答済み
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...

15年以上 前 | 12

回答済み
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);...

15年以上 前 | 1

質問


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

15年以上 前 | 3 件の回答 | 2

3

回答

回答済み
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 ...

15年以上 前 | 6

| 採用済み

回答済み
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)));

15年以上 前 | 4

| 採用済み

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

15年以上 前 | 1

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

15年以上 前 | 0

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

15年以上 前 | 5

回答済み
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...

15年以上 前 | 3

回答済み
MATLAB GUI
Would UITABLE be what you want?

15年以上 前 | 0

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

15年以上 前 | 2

回答済み
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...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 1

回答済み
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]; ...

15年以上 前 | 0

回答済み
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) ...

15年以上 前 | 1

| 採用済み

回答済み
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...

15年以上 前 | 0

回答済み
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...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 1

回答済み
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)); ...

15年以上 前 | 0

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

15年以上 前 | 1

| 採用済み

回答済み
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...

15年以上 前 | 2

回答済み
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,...

15年以上 前 | 1

回答済み
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...

15年以上 前 | 1

回答済み
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; ...

15年以上 前 | 0

さらに読み込む