Answered
Analyse and make pattern from csv file
You will have to define a little better what you want to extract when errors are logged, but here is an example using REGEXP: ...

13 years ago | 0

Answered
Multiplying matrices as cells - 4 dimensional with variable no. of matrices (code works now!)
As you have only a limited number of values for |f|, you should avoid using complicated 3D or 4D arrays (indexing them is not al...

13 years ago | 0

| accepted

Answered
Data Saving - Storage Efficiency
>> f_dbl = 1 ; >> f_log = true ; >> whos Name Size Bytes Class Attributes f_dbl 1x1 ...

13 years ago | 0

Solved


Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

13 years ago

Answered
More Efficient Assignment Operation - Sparse Matrix
See: <http://www.mathworks.com/matlabcentral/answers/69528-sparse-matrix-more-efficient-assignment-operation>

13 years ago | 1

Answered
Not sure what I'm doing wrong. FOR LOOP
Difficult to know without seeing your sequence, but imagine that the cell array |codons| contains 60 characters.. when t = 60, a...

13 years ago | 0

Answered
Sparse Matrix - More Efficient Assignment Operation
The structure of sparse matrices in memory makes this kind of indexing operations slower than building the sparse matrix directl...

13 years ago | 2

Answered
How many times does each number appear?
Hi Hamad, Well, how large is "extremely large"? Image Analyst might have given you the optimal solution already. As an altern...

13 years ago | 2

Answered
Form strings/numbers from matrix
If you want numbers: >> A = [1 2 0; 0 2 6; 9 8 0; 0 0 2] A = 1 2 0 0 2 6 9 8 0 ...

13 years ago | 1

| accepted

Answered
create n arrays in matlab
If you really want to build |n| separate arrays, you will have to store them in a cell array, unless you want to dynamically gen...

13 years ago | 1

Answered
Is there a clean way to find the number of elements in a vector that are "near" a specified constant?
Yes, you can proceed as follows: >> n = sum(abs(A-100) < 5) n = 8

13 years ago | 0

| accepted

Answered
how do i create a recursive function that gives the number of digits in an integer? i.e. does the same that length function does in MATLAB
As Wayne mentioned, recursivity in unnecessary, but if you had to implement a recursive function, you could have built something...

13 years ago | 1

| accepted

Answered
read a number after a specific string in a txt file
As it's a bit more elaborate than your previous question, it might be time to go for a regexp solution (even though you can alwa...

13 years ago | 3

| accepted

Answered
Faster Method for removing duplicates
>> node_u = unique(node, 'rows', 'stable') node_u = 0.1234 5.6789 3.4567 9.8765 4.5678 8.7654 shou...

13 years ago | 1

| accepted

Answered
compute the repetition of a string in a text file
Your best option for pattern matching is usually regular expressions (regexp). In this particular situation where the pattern...

13 years ago | 0

| accepted

Answered
Merging cell arrays with variable number of elements
x = {A, B{:}, C} ; In this expression, |B{:}| is a comma separated list (CSL); it is equivalent to listing |B|'s cells' cont...

13 years ago | 0

| accepted

Answered
colon operation (:) causes parfor to fail on cell array
It has a priori nothing to do with PARFOR; the expression involving the colon on the left hand side is a comma separated list (C...

13 years ago | 1

Answered
Deleting Zero Rows - Matlab Noob
B(B(:,1)==0,:) = [] ;

13 years ago | 4

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
An optional *chat room* with a *main channel* and *thread-specific channels* or user defined channels would be awesome. The rati...

13 years ago | 0

Answered
Using TEXTSCAN to import an ASCII file with a header and blank lines between different data sets
An alternative could be to use REGEXP to get blocks of data, e.g. in a struct array, and then post-process the content. To illus...

13 years ago | 2

| accepted

Answered
Maximize similarity of vectors
I've never done anything like that, but you picked my curiosity so I gave it a quick try.. v1 = [1 1 2 1 2 3 3 1 1 2] ; v...

13 years ago | 0

Answered
Finding durations between 1's in a matrix
If you had the following matrix |I| for example: >> I = rand(10,5) > 0.6 I = 0 1 1 0 0 0 1...

13 years ago | 0

Solved


Convert a cell-array of values to MATLAB source code
The MATLAB interpreter loads your code and executes it using the Read-Evaluate-Print-Loop (see <http://en.wikipedia.org/wiki/REP...

13 years ago

Answered
How to randomly shuffle cards?
Look at the doc for RANDPERM. You can use it to shuffle a set of 1 to N integers: >> randperm(12) ans = 5 8 ...

13 years ago | 0

Answered
How to avoid using a global variable in this case
I thought that you were talking about OOP with your initial question, but if not, it is not a good idea to overload common opera...

13 years ago | 0

Answered
What is not "a finite, nonsparse, real integer vector" but looks like one? Error using circshift>ParseInputs (line 71)
>> A = rand(4) > 0.5 A = 1 0 0 0 1 0 1 1 0 0 0 1 0 1 1 ...

13 years ago | 0

Answered
fgetl drops part of line
Could you copy/paste here the first 10-20 lines of one of these files? Have you tried to read the full file in one shot and then...

13 years ago | 0

Answered
Matlab function/code similar to excel vlookup?
Look at this example: >> x = [1, 4, 2, 5, 3, 7, 6] ; % Fake x and y. >> y = x + 10 ; >> for k = 1 : 7, y(x == k), ...

13 years ago | 0

Answered
Improve result of text file
If you evaluate class(R{3}) class(R{1:2}) you will realize that these are cells/arrays. You need to index one step furt...

13 years ago | 0

Answered
Analysis and Prediction of Optimal Array Size of Pre-allocation.
Depending the nature of your computation, you can get an "analytical estimate", e.g. " _memory usage grows like_ |n^2|" for a gi...

13 years ago | 0

| accepted

Load more