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...

6 years 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...

6 years 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 ...

6 years ago | 0

| accepted

Answered
Joining 2 tables to make 1 table
Sounds like you merely want to vertically concatenate your two tables. The only problem is that they don't have the same variabl...

6 years ago | 0

Answered
Using a column vector of indices to replace values in a matrix
Well, now you have explained how you got C, a much simpler method than the accepted one is not to create C and use: M(~R) = 0; ...

6 years ago | 1

Answered
How to read different data types from a txt file
lines = strsplit(fileread('C:\somewhere\yourfile'), {'\r', '\n'}); lines will be a cell array with each cell containing a line ...

6 years ago | 0

| accepted

Answered
Trying to avoid using eval for looping through structures with data in the variable names.
You could generate the variable name without a loop but unfortunately, yes in this case you'll be forced to use eval to access t...

6 years ago | 0

| accepted

Answered
If else statement problem
I would suspect that the reason you always get 'failed' is because your idx is not scalar, in which case you need to loop of eac...

6 years ago | 0

Answered
exctract column from files
Simply use readtable which has no problem parsing the file: locations = readtable('New Text Document.txt'); locations.Properti...

6 years ago | 1

Answered
automatically iterate numbers in a text file
root = 'C:\Users\Administrator\Used_files'; user_input_squad = input('please enter squad number: '); user_input_experiment = i...

6 years ago | 0

| accepted

Answered
Draw horizontal lines using for loop on set of images
" I don't have [the computer vision] tool box" Then you have several options, none of them ideal draw your image into a matlab...

6 years ago | 1

Answered
simple way of matrix array resorting
Assuming your 3 vectors are row vectors (i.e. 1xN), then result = [A; B; C].' %vertically concatenate then transpose

6 years ago | 0

Answered
How to write values from two different cell arrays to a text file in a specific format?
The conversion to JSON is easily done: cellfun(@(a, d) jsonencode(struct('audioData', a, 'distractorData', d)), youraudiocellar...

6 years ago | 0

| accepted

Answered
Check if input is a 4 element vector
The simplest way to do this kind of checks is to use validateattributes which will give you consistent comprehensive and localis...

6 years ago | 0

| accepted

Answered
How to import csv-file with headlines (type text) to matrix? - only numbers are needed
Both readtable and readmatrix will handle this file without issue. I would have thought that importdata would delegate to readta...

6 years ago | 0

| accepted

Answered
Analyze netsh wlan show all for RSSI distance and location
Here is a way to parse your netsh output. Note that it assumes that each SSID has only one BSSID, If there is more than one, you...

6 years ago | 2

| accepted

Answered
Why the 'ismembertol' function fails on this 5 lines code?
As per my comment, I raised a service request with Mathworks and they have confirmed that it is indeed a bug. As the bug is not...

6 years ago | 0

Answered
Extra commas when using fprintf
Personally, I'd use: fprintf(" Old Means: (%s)", strjoin(compose('%.4f', M(:, :, i)), ','));

6 years ago | 1

| accepted

Answered
Sorting distance traveled by timestamps
So, you've got easy to use datetime in your array and you go and convert to harder to use datenum and then to single. Why? The ...

6 years ago | 0

| accepted

Answered
How map values of array to 0 and 1
It's trivial normalisation. Subtract the minimum of your array so the new minimum is 0, then divide by the max of that new array...

6 years ago | 1

Answered
Why am I getting "Array indices must be positive integers or logical values" when trying to add together all the integers?
Most likely you've created a variable called sum, so instead of summing the elements of Cost, you're using Cost as an index into...

6 years ago | 1

Answered
extract specific file from list of folders
First. you shouldn't be using addpath just to be able to load some data. addpath is intended to make code files visible, not dat...

6 years ago | 0

| accepted

Answered
Importing data to change a NaN
You should be using readtable to load your data into a table. You could also use readcell but this would complicate things. You ...

6 years ago | 0

Answered
How do I isolate rows from a table, containing the same column value?
There is no need to sort the table beforehand: [group, schoolname] = findgroups(MASSADOC.school); %get unique schools and assi...

6 years ago | 0

| accepted

Answered
Delete a dimension from a 3d array to convert into a 2d array (Matrix)
squeeze(yourarray) or permute(yourarray, [2 3 1]) squeeze is simpler and will get rid of all singleton dimensions.

6 years ago | 1

| accepted

Answered
Set properties of child objects without synchronisation errors
As I wrote in my comment to J. Alex, I don't see a problem with your initial design if the pipes can't be modified outside of th...

6 years ago | 0

Answered
why save '.mat' as 'ascii' file appears as FILE instead of txt
If you want the file to have a .txt extension, then simply tell matlab so: filename1 = fullfile(name_folder_new,'coefficients_...

6 years ago | 1

| accepted

Answered
Why am I getting 387 as the sum of my vectors when I input 1x1x1?
Your problem is not with str2num (although using str2num is not recommended, but that's another topic). Your problem is more fu...

6 years ago | 0

| accepted

Answered
Replace a value in a vector with another
idx=(true,Failuretimesdet(k)==0) is not valid matlab syntax, I'm not even sure what you're trying to do with this. You seem to...

6 years ago | 0

| accepted

Answered
Creating cell arrays and 'Operands to the || and && operators must be convertible to logical scalar values.'
While an if expression can be non-scalar in matlab it's never a good idea as many people (I assume you included) do not know how...

6 years ago | 1

Load more