Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

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

13 years ago | 1

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

Answered
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 years ago | 1

Answered
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 years ago | 1

Answered
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 years ago | 2

| accepted

Answered
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 years ago | 1

Answered
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 years ago | 1

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 1

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 1

| accepted

Answered
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 years ago | 0

| accepted

Load more