답변 있음
how to multiply and concatenate at same time?
Kronecker product would be suitable if we could apply it along a given dimension, but it seems that we can't. As an alternative,...

13년 초과 전 | 0

| 수락됨

답변 있음
how i can select an indice in vector and matrix
If you are sure that |phix| and |tx| will be entered so they match exactly elements of |T| and |phi|, you can do the following: ...

13년 초과 전 | 1

| 수락됨

답변 있음
how to get the most repeated element of a cell array?
the cyclist >> *I knew I had overlooked something easier. :-)* Well, look at how *I* did _overlook something easier_ ;-D : ...

13년 초과 전 | 0

| 수락됨

답변 있음
What is the Sutable Laptop with MATLAB?
To be honest, the main thing that I would pay a lot of attention to is to make sure that whatever graphic card you take, it has ...

13년 초과 전 | 0

답변 있음
extract from text file
New version, taking into account your last comment. fname_in = 'myFile.txt' ; fname_out = 'myFile.xlsx' ; headerSize ...

13년 초과 전 | 1

| 수락됨

답변 있음
Function giving incorrect answer
It was almost correct; you just forgot to assign the result to an output argument (that I named "result" below, but you are free...

13년 초과 전 | 0

| 수락됨

답변 있음
Loading ascii data file with headers
The following would be an option: [index, distance, tip_A] = textread('myFile.txt', '%d %f %f', 'headerlines', 3) ;

13년 초과 전 | 1

답변 있음
Good non-specialized book for MATLAB
You could use the PDFs mentioned here: <http://www.mathworks.com/matlabcentral/answers/73550-starting-matlab-and-not-experien...

13년 초과 전 | 1

답변 있음
How to add any number of variables together in all combinations?
You can use NCHOOSEK. You should avoid using EVAL actually, which is quite slow, and rarely appropriate. Also, look at the doc o...

13년 초과 전 | 1

답변 있음
Transposing blocks of matrices from a bigger initial matrix
So you don't have |A|, |B|, |C|, etc, but a large |M| that you have to split/transpose/cat? If I understand well what you wan...

13년 초과 전 | 2

| 수락됨

답변 있음
replacing NaN with zeros in a cell column of strings
You can go for something like: A(cellfun(@(x)all(x~=x), A)) = {0} ; but it is just "cosmetic" (in some sense) and the loo...

13년 초과 전 | 1

답변 있음
some errors when i try to use the code of snake
You are calling |parse_inputs| without passing any argument, whereas it requires one (at least). After this call (where neither ...

13년 초과 전 | 1

답변 있음
How to vectorize writing to a txt file
You could go for something like this: buffer = sprintf('(%f,%f),', [time; signal]) ; % FormatSpec repeated. buffer(end)...

13년 초과 전 | 0

| 수락됨

답변 있음
Batch Process for CSV files
It seems that you have two levels of loops, yet you are using the same loop index for all loops. This creates a conflict (essent...

13년 초과 전 | 0

답변 있음
How to transfer a sparse matrix into a block diagnal matrix efficiently?
I would go for something like: % - Build example case. K = 3 ; N = 4 ; A = sparse(randi(10, K*N, N)-1) ; % - Extr...

13년 초과 전 | 0

| 수락됨

답변 있음
load columns from file with headlines and dates
Assuming that the date/time column has always the same format, the first value starts at char 22 and you can do something like: ...

13년 초과 전 | 0

답변 있음
Values of intersection points of plot. Print results.
*EDIT:* this answer is *wrong*, I answered too quickly without paying attention to the fact that your |x| is the output of an OD...

13년 초과 전 | 0

답변 있음
How to make and save image for each iteration in a for loop?
I understand now; you'll want something like: filename = sprintf('mat_img_%d.jpg', n) ; imwrite(B, filename, 'png') ; N...

13년 초과 전 | 0

| 수락됨

답변 있음
Deleting empty rows in a 3D Cell Array in MatLab
If you want to be able to remove rows from single "pages", you should use a cell array of cell arrays, e.g. A = cell(3, 1) ;...

13년 초과 전 | 1

| 수락됨

답변 있음
improve efficiency of a matlab code that includes for loop and if statement
It really depends whether BLKIMPV can work on vectors. If so, you can go for something like: dataset = zeros(size(data9,1), ...

13년 초과 전 | 0

| 수락됨

답변 있음
Passing a .txt file as a function parameter
You should pass file names to the function and/or a base path. filenames = {'a.txt', 'b.txt'} ; % Cell array of fi...

13년 초과 전 | 1

| 수락됨

답변 있음
Large Sparse Matrix Summation
Why can't you use a loop? Is |K| that large? If you are looking for efficiency, I'd say that you could directly build |A| in ...

13년 초과 전 | 0

답변 있음
updating a second matrix in specific lines as you loop through a first one
If elements of column 1 of |AAA| are really positive integers, you can create |BBB| as a vector and index the element in |BBB| w...

13년 초과 전 | 0

| 수락됨

답변 있음
How can I separate similar values in an array?
You can use an approach based on the following: % - Define threshold (max diff. that doesn't break a group). threshold = ...

13년 초과 전 | 0

답변 있음
How to add values to already existing ones in a matrix using for loop?
Like this: KG = zeros(size(Ke)) ; % Prealloc (are they same size?) % and initia...

13년 초과 전 | 1

답변 있음
Why am I getting this error "??? error using ==> times matrix dimensions must agree" in matlab?
You have to transpose either |wk| or |hd|, because one is a column vector and the other a row vector. E.g. hn = hd .* wk.' ...

13년 초과 전 | 0

| 수락됨

답변 있음
How can I optimize code for explicit scheme?
You can compute A = repmat(a(2:N_space-2), 1, N_v) ; B = repmat(b(2:N_space-2), 1, N_v) ; C = repmat(c(2:N_space-2), 1, ...

13년 초과 전 | 0

답변 있음
create vector that consists only of zeroes
err = zeros(size(data13,1), 1) ; but don't call it "error" as it is the name of a function.

13년 초과 전 | 0

| 수락됨

답변 있음
How do I keep updating and accumulating my arrays as I read multiple files one after the other
You could go for something like: words = {} ; for k = 1 : 2 buffer = fileread(sprintf('testing%d.m', k)) ; words ...

13년 초과 전 | 1

| 수락됨

답변 있음
any ideas how to make the code more efficient? Now it takes a few days!
You probably want to do something like the following (to adapt to your case, *and check that it is working*): n_img = 200 ; ...

13년 초과 전 | 0

| 수락됨

더 보기