Answered
How to insert new empty lines in middle of an exisiting text file
One of the many possible ways to do this: filepath = 'c:\somewhere\somefile.txt; contents = fileread(filepath); lines...

9 years ago | 0

Answered
Averaging sections of a textfile
tables have all sort of built-in functions to do what you want. No need to convert the table back to an array or to use |accumar...

9 years ago | 2

| accepted

Answered
Why is my loop only running 217 times when I expect it to run 649 times? See the script below
The whole script does not make much sense: for p = 1:length(m(1,:)) First thing: forget about |length|, it's not a good ...

9 years ago | 0

Answered
Indexing array to multiple substrings
ismatch = ~cellfun('isempty', regexp(names, strjoin(regexptranslate('escape', tags), '|'))); result = names(ismatch) The...

9 years ago | 1

| accepted

Answered
replace comma with dot in large array
Well, the slow bit is probably your |cellfun(@str2num)|. Replacing that by: data = str2double(data); would probably be f...

9 years ago | 1

| accepted

Answered
Reading parameters from a text file into the workspace
There are many ways you could do what you want. The way I'd do it: filecontent = fileread(filename); paramvalues = regex...

9 years ago | 0

Answered
Why can't MATLAB access a file that is in its current directory?
Your screenshots clearly show that the current directory is |C:\Program Files\MATLAB|. The |Program Files| directory is a system...

9 years ago | 2

Answered
Delete rows with characters in cell array
As said, ignore attempts to build your own custom string parser, it's inefficient and a complete waste of time. Use a regular ex...

9 years ago | 4

Answered
while condition to test numeric
Carefuly, read the documentation of <https://www.mathworks.com/help/matlab/ref/input.html |input|>. In particular: * _If the ...

9 years ago | 1

Answered
Memorize Initial Position of Columns in a Matrix
Matlab does not _think anything_. The first column has index 1, the second has index 2 *by definition*, regardless of what you'd...

9 years ago | 0

Answered
Tabulate hates non-finite parties.. When they are incomplete
I have no idea how |tabulate| is implemented as I don't have the stats toolbox. From reading the docs, it is trivial to implemen...

9 years ago | 0

Answered
load mat table to gui table
Firstly, a much simpler version of your original code: data_plat = load('Data_Plat.mat'); Database_All = data_plat.Datab...

9 years ago | 0

| accepted

Answered
What does "Struct(1).file=Out_mat" mean?
The whole excerpt you've posted is of poor quality. Unnecessary |clear| (twice!), |close|, inconsistent formatting, unnecessary ...

9 years ago | 1

Answered
what does imloadfunc do?
That global variable |imloadfunc| is s switch that tells which function to use to read images. If it is set to |'pgma_read'|, th...

9 years ago | 0

Answered
Is there a way to average sequential data on an array and then be able to split the array?
The modern and easy way to do what you want is certainly not by hand, and not with a loop either: demomatrix = rand(60, 10)...

9 years ago | 2

| accepted

Answered
Using filepath input in fopen
The proper syntax is indeed your first example: fid = fopen(pathvariable, 'r'); There could be many reasons for why it d...

9 years ago | 3

| accepted

Answered
How can I check if a certain matrix is one of the cells of my cell array?
cellfun(@(c) isequal(c, b), A) would give you a logical matrix. If you just want yes/no answer: any(cellfun(@(c) isequ...

9 years ago | 2

Answered
Mapping a plane onto a 3D matrix?
The correct way to get the best approximation would be to find an equivalent to <https://en.wikipedia.org/wiki/Bresenham%27s_lin...

9 years ago | 0

| accepted

Answered
How to assign a lat and lon value to 1 variable?
As has been commented, you do not want to create 66 variables, it's pointless and would make your life much harder, not easier. ...

9 years ago | 1

| accepted

Answered
how can solve this error "Attempt to reference field of non-structure array."
You have |X.Y| in your formula. Most likely it's a typo but we've no idea what you meant to write. Also note that |something/...

9 years ago | 0

| accepted

Answered
Make structures from a cell and store them in a new cell
As per Stephen's comment using a non-scalar structure as the final result would make a lot more sense (and be a lot easier). ...

9 years ago | 0

Answered
Find out number of bits needed to represent a positive integer in binary?
trivially with <https://www.mathworks.com/help/matlab/ref/log2.html log2> (and <https://www.mathworks.com/help/matlab/ref/ceil.h...

9 years ago | 1

| accepted

Answered
Remove values from cell array based on condition
I can't help but feel that you're doing something very wrong if you want to do what you're asking. Your problem is very ill-defi...

9 years ago | 0

| accepted

Answered
Storing values in vectors corresponding to a vector of indices
If I understood correctly: splitvectors = mat2cell(yoursignal, diff([0, yourindices, numel(yoursignal)]))

9 years ago | 0

Answered
Finding a series of numbers in a cell
It's not clear exactly what pattern you're looking for. The following will work for your first five numbers: str2double(reg...

9 years ago | 0

| accepted

Answered
How can I connect points with line segments?
As John said, what's the problem? Get the pairwise distance between all points, find the index of the pairs below your threshold...

9 years ago | 1

| accepted

Answered
Find the vector of medians
One way: v = [1,2,3,-1,-2,-3,4,5,6,-7,-6,-3,-5,-4]; transitions = find(diff([0, v<0, 0])); result = arrayfun(@(s,e) m...

9 years ago | 0

Answered
Computing difference between maximum values in columns of matrix within predefined time interval
The first step would be to identify the local maxima (and their row index) in val1 and val2 using <https://uk.mathworks.com/help...

9 years ago | 1

| accepted

Answered
User input to change the name of an existing variable
Don't do it! You want several related variables that can be easily enumerated: there's already a mechanism for that in matlab, i...

9 years ago | 1

Answered
How to set up the path for a tree class download from internet?
Packages in matlab do not work like namespaces in any other language I know. In particular, functions and classes within a packa...

9 years ago | 0

Load more