Community Profile

# Cedric Wannaz

849 total contributions since 2013

General interest: interdisciplinary approaches to complex problems (in particular mixing Mathematics, Physics, and Computer science).

View details...

Contributions in
View by

extract data from EEG text file
Using the data text file that you provided elsewhere (renamed and attached to this answer), here is a short example of one way t...

| accepted

How to sum repeated adjacent values in a vector
Here is one way: Y = splitapply( @sum, X, [0, cumsum( diff(X) ~= 0 )] + 1 ) ; or, split into two expressions that make it easi...

Comparing Data sets with same numbers of Array
As you have no N-NE direction, here is an example for SE-S: dayId = [1, 5, 10, 15, 50, 60, 92] ; cat_sub = cat_wind_direct...

| accepted

How do I extract points from multiple circles?
We cannot test without your data, but the approach seems fine. You could use the PDIST2 function and extract everything in one s...

| accepted

python with matlab, undefined variable py?
Try going through: https://www.mathworks.com/help/matlab/matlab_external/undefined-variable-py-or-function-py-command.html and ...

How to write cell array into a csv file
To write the data in C to a CSV file. Use “writetable” in combination with the “cell2table” function. % Convert cell to a tabl...

| accepted

How to slice each string in a string array without using for loop
If you favor performance over readability/maintainability, you can build an approach around the following: buffer = vertcat(...

| accepted

How to retrieve z value from surf plot given x and y?
Interpolate with |INTERP2| : <https://www.mathworks.com/help/matlab/ref/interp2.html> where |Xq| and |Yq| are defined using t...

| accepted

Writing a loop to calculate a seasonal cycle and then plot the seasonal cycle?
Where is |t| defined? In addition, |month_mean| is your intermediary variable; you want to plot either |seasonal_cycle| or |s_cy...

mer än ett år ago | 0

How to read large text data into matlab
If you have enough RAM for this, the following could run a little faster. It is way less versatile than Per's solution though, a...

mer än ett år ago | 1

| accepted

How can I create a matrix with the values of the elements is a function of the indices?
Not sure that I understand. If you wanted to create a rectangular array whose elements are a the result of some arithmetic opera...

mer än ett år ago | 0

| accepted

Strfind to contain complex pattern
Here is an approach: str = 'John played volleyball. I love Anna. Are you there?' ; buffer = strtrim( strsplit( str, {'....

mer än ett år ago | 0

| accepted

Rearrange cell content by groups
Hi |dpb|, Assuming that you have a cell array (and that you are using this _table type of output_ just for a _display purpose...

mer än ett år ago | 0

Question

Solving A{k} * x + b = 0 for large numbers of A{k} with same structure/filling.
Dear all, &nbsp;&nbsp;I am trying to improve the efficiency of solving |A{k}*x+b=0| for |x|, that I currently solve using the...

mer än ett år ago | 2 answers | 0

### 2

Question

Should I (and how to) avoid "forests" of listeners in nested OOP structure.
Dear all, &nbsp;&nbsp;&nbsp;I never used more than the basics of events and listeners, and I could benefit from the input of ...

mer än ett år ago | 0 answers | 0

### 0

Question

Dynamic superclass name in call to superclass method.
Dear all, &nbsp;&nbsp; In a particular context, I could benefit from being able to use _"dynamic superclass naming"_ in calls...

mer än ett år ago | 0 answers | 2

### 0

Question

Error management in OOP framework.
Dear all, &nbsp;&nbsp;&nbsp;I am trying to implement an error management mechanism that allows building very detailed error r...

mer än ett år ago | 1 answer | 1

### 1

How to vertcat 100 matrices ?
If they are stored in cell array |M|: Mvcat = vertcat( M{:} ) ; where |M{:}| is what we call a _comma separated list_ (CS...

nästan 2 år ago | 1

| accepted

print leading and trailing zeros into text file
>> dec2hex(195112160, 8) ans = '0BA12CE0'

nästan 2 år ago | 0

| accepted

Finding and saving identical rows in a matrix
Alternatively: [~, ~, ic] = unique( A(:,1:2), 'rows' ) ; groups = splitapply( @(x){x}, A, ic ) ; produces groups = ...

nästan 2 år ago | 1

| accepted

How extract sub matrix without zeros from a big matrix
Here is an example; we first build a test data set: >> N = randi( 10, 10, 4 ) ; >> for k = 1 : 10, N(k,1+randi(3,1):end) =...

nästan 2 år ago | 0

| accepted

How to remove repeating elments from a matrix?
Almost, the idea was correct but you were not working on the correct dimension. Also, sorting the input array vertically makes c...

nästan 2 år ago | 0

| accepted

sum of matrix omitting one dimension
Here is one way, but there is probably a simpler approach: buffer = arrayfun(@(k) permute(KL, circshift(1:ndims(KL), k-1)), ...

nästan 2 år ago | 0

Split array into cell arrays of different size
>> seqs = mat2cell( A, 1, diff( [strfind(A, [5,19]), numel(A)+1] )) seqs = 1×5 cell array {1×4 double} {1×3 doub...

nästan 2 år ago | 0

Find if two sparse matrix have 1 in same position
Do you need something along this line? % - Build small test case. A = sprand( 4, 5, 0.5 ) > 0 ; % 4x5 sparse. B =...

nästan 2 år ago | 0

| accepted

How to import Text File with 2 different Delimiters (how to organize header data and numeric data)
You may not need to use header information for parsing your file. Look at this example (applied to |data.txt| attached): ...

nästan 2 år ago | 0

Any tips for bsxfun and repeated calculation?
If you have MATLAB R2016b or above, BSXFUN was replaced by automatic expansion and you can do it as follows: >> D = repmat( ...

nästan 2 år ago | 0

| accepted

sum along data with different steps
Interestingly, the following seems to produce what you are looking for: >> expandSum = @(x,n) sum(reshape(cell2mat(arrayfun(...

nästan 2 år ago | 1

| accepted