Community Profile

Contact

Top 1% contributor

In <http://de.mathworks.com/matlabcentral/answers/175074#comment_264181 a comment> to my own comment (advising the OP to not use...

4 Answers

4

Asked 5 months ago

102 downloads

6 months ago

Unless you have good reasons to use cell arrays, then the simplest answer is to store your data in *one* numeric array and use t...

accepted

5

Answered 6 months ago

There are several natural order sort functions available on MATLAB File Exchange, but these all naively treat filenames as a sim...

8775 views

Responded 9 months ago

Basically you should not do this. Using dynamically defined variable names or encoding data within the variable name is a pretty...

Try this: '1010' - '0' or equivalently: '1010' - 48

Answered 9 months ago

You can simply wrap the |strfind| inside |isempty|, like this: >> ~isempty(strfind('Schroedingers cat is alive!','cat')) ...

3

Answered 1 month ago

* Instead of concatenating file-paths together, you should use <http://www.mathworks.com/help/matlab/ref/fullfile.html |fullfile...

>> N = 6; >> pow2(floor(log2(N))) ans = 4 And it is even fully <http://www.mathworks.com/help/matlab/matlab_p...

Use <http://www.mathworks.com/help/matlab/ref/bsxfun.html |bsxfun|> for this: >> A = [1, 3; 4, 2] A = 1 3 ...

Answered 2 months ago

Both Geoff Hayes and Grieg have made some good points about simplifying the |if| statements, but it seems no one has addressed t...

Answered 4 months ago

If the |127x4| matrix is named |A|, then use mean(A) If you want to be more precise about which dimension it calculates ...

Answered 5 months ago

If you are talking about creating files with sequential filenames, these might be helpful to read: http://www.mathworks.com/m...

Ugh... bad idea! Avoid creating dynamically named variables in MATLAB. This is poor practice as has been explained many times...

2

Answered 2 days ago

Thank you for editing your question and making it clearer. You can use <http://www.mathworks.com/help/matlab/ref/regexp.html ...

Answered 12 days ago

*Intersection*: simply use <http://www.mathworks.com/help/matlab/ref/intersect.html |intersect|> with the |stable| option: ...

Answered 23 days ago

Here is a solution using no loops, and only <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code...

It is likely that the data are <http://www.mathworks.com/help/matlab/matlab_prog/floating-point-numbers.html floating point> and...

This requires just *one* small change to the solution to <http://www.mathworks.com/matlabcentral/answers/195663-txt-file-to-matl...

That syntax is not MATLAB syntax at all: MATLAB <http://www.mathworks.com/help/matlab/ref/if.html |if|> does not use a |then| st...

Answered 3 months ago

It is not clear exactly what your question is: are you having difficulty reading this data from the file, or converting the text...

Use a <http://www.mathworks.com/help/matlab/cell-arrays.html cell array> like this: out = cell(1,max_trials); for trial ...

Use <http://www.mathworks.com/help/matlab/ref/dir.html |dir|> instead. If you only want to know about the _existence_, then you ...

If you know how many columns you want, then you can simply assign them in code like this: >> A = [1,2;3,4;5,6]; >> X1 = ...

Unlike numeric and character arrays, according to the documentation both structures and cell arrays _do not require completely c...

The code has multiple issues that need to be fixed. Here a a couple of things to improve: * The <http://www.mathworks.com/hel...

You gave this code in a comment to my other answer: size(f)==[1,350] size(r)==[50,50,900] for ii=1:350 for ...

You did not state in your question how you are runing this code, so I assumed that it is in a script. You can store the output o...

You could use my FEX submission |natsortfiles|: http://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filen...

To get the digits in a scalar numeric: >> x = 1.23456789; >> N = 4; >> n = fix(rem(x,1)*10^N) n = 2345 then to ...

Load more