Answered
Is this a valid expression?
As matlab tells you is not valid, you can't have (:) on the output of a function. Since (:) is simple a reshape, tmpOffsets = ...

10 days ago | 0

Answered
Find the index of zero in cell and put it as empty
A(cellfun(@(x) isequal(x, 0), A)) = {[]}; %replace any cell whose content is the scalar 0 by empty is one way. edit: fixed co...

11 days ago | 0

| accepted

Answered
Unable to perform assignment because the left and right sides have a different number of elements.
Your criteria for the cluster connectivity is a bit strange in my opinion since it doesn't actually require adjacency. If that's...

11 days ago | 0

| accepted

Answered
readtable() Giving NaN for some data files (.txt)
Certainly, it's not clear what is confusing readtable with your second file. Whatever it is it has to do with the space characte...

11 days ago | 0

Answered
Finding columns that contains a specified string
The format of your excel file is really not ideal. Anyway, this is one way: header = readcell('Rahmani.xlsx', 'Range', '1:4'); ...

11 days ago | 0

| accepted

Answered
how to add rows at missing times in a table?
The easiest would be to convert your table into a timetable. You could indeed use the unix time after converting it into datetim...

12 days ago | 1

| accepted

Answered
Making cell array of cells of strings the same size by adding empty strings
maxlen = max(cellfun(@numel, yourcellarray)); newcellarray = cellfun(@(s) [s, repmat({''}, 1, maxlen - numel(s))], yourcellarra...

12 days ago | 0

| accepted

Answered
Trying to Set Data in UITable, but getting error: Values within a cell array must be numeric, logical, or char
The error message is indeed correct. All the elements of rows 2:end of column 1, 6 and 11 of your cell array are themselves 1x1 ...

12 days ago | 0

Answered
How to convert cell columns in a table?
Probably, data = readtable('LA-01.csv', 'Delimiter', ' ', 'MultipleDelimsAsOne', 1, 'TreatAsEmpty', 'N/A') would fix the probl...

12 days ago | 0

Answered
Converting and Instrument Object Array (instrfind) into strings?
I don't have any serial port on this machine so can't really test for the actual property names, but it should be something like...

12 days ago | 0

| accepted

Answered
Nonlinear regression fits on data sets in a cell array?
For the problem with the tables: Before the loop: fittables = cell(1, numel(theFiles)); %preallocate cell array to store all ...

12 days ago | 0

Answered
Automatic legend changing based on the function
First, minor things: I would recommend you put a space (preceded by a colon maybe) at the end of your input strings so that wha...

29 days ago | 2

| accepted

Answered
Replace NaN with next good value in a certain column of a table
It's as simple as: T2 = fillmissing(T2, 'next', 'DataVariables', {'lat', 'lon', 'station_elevation'}) or T2 = fillmissing(T2...

29 days ago | 1

| accepted

Answered
How can I iterate all three cases at once in one script?
"rather than having to change to and every single time and in multiple lines." The problem is that you've hamstrung yoursel...

29 days ago | 1

Answered
Keeping Order of sql query in Matlab? How can I speed up my Code?
I don't have the database toolbox, but according to the online documentation fetch returns a table by default. If it's not the c...

1 month ago | 1

| accepted

Answered
Comparing array with any element of the array
Ok, now I understand what you want to do. Note that datasets have been deprecated for a while and it's recommended you use tabl...

1 month ago | 0

Answered
Generating combination of binary numbers
nchoosek outputs the indices in your desired ordering, so it's easy: N = 5, M = 2; %demo data cols = nchoosek(1:N, M); A =...

1 month ago | 1

| accepted

Answered
How can I get the root node of a given node from a directed graph ?
the first element of the vector returned by toposort would be your root node. Of course, your graph must be acyclic and if your ...

1 month ago | 0

| accepted

Answered
I don't know why hold on wont work- it only produces one graph with one model and not both on one graph
Your code creates a figure and sets the axis to retain plots in this figure with hold on. Your code then creates a second figur...

1 month ago | 0

Answered
Index in position 2 is invalid. Array indices must be positive integers or logical values.
The error message is clear, the index in position two is invalid because it contains either non-integer values or values less th...

1 month ago | 0

Answered
Illustrate weighted matrix to represents areas
You can do something like: weights = [0 0 0 0 0 0; ...corrected spelling of the variable 0 0 0 1 0 0; 0 1 1 1...

1 month ago | 0

Answered
kill an external process (simulation ) if it is taking too long
You could use a timer for this, it would be something like: killtimer = timer('ExecutionMode', 'singleshot', 'StartDelay', 5, '...

1 month ago | 0

Answered
Label segments based on percentage
Much simpler code: threshold = 0.3; %30% threshold M = cellfun(@(m) mean(m, 1) >= threshold, AL_128, 'UniformOutput', false) ...

1 month ago | 0

| accepted

Answered
R2019a blank property inspector macOS Catalina
This is a known issue with no workaround currently. See this answer by Mathworks.

1 month ago | 0

Answered
Is there a function alternative to get array/matrix/cell elements?
Indeed it would be very nice to be able to chain indexing to function calls. I believe it's an often requested enhancement but i...

1 month ago | 1

Answered
Create cell array of numbers
This is dead easy if you are happy using the newish string type instead of char vectors: s = string(1:10) You can convert that...

1 month ago | 0

| accepted

Answered
creating multiple copies of an array
"indexing will be hard because I will need to copy it for more [...} I will need to copy it for 5000" Please read Stephen's li...

1 month ago | 0

Answered
how to get hourly meshgrids?
It's unclear what you're trying to do with your code since it's not commented. There are certainly a number of things that don't...

1 month ago | 0

Answered
Merge and Center in Excel
That's because of this line: eSheet1 = eSheet1.get('Range', 'B1:C1'); which replace the former value of esheet1 which use to b...

1 month ago | 0

| accepted

Answered
Halley's Comet Error
"How an I fix this" By defining x_old before using it (in the while loop)? Perhaps: x_old = Inf; while abs(x-x_old)>acc ...

1 month ago | 0

| accepted

Load more