Answered
Sorting and Re-arranging a text file using Matlab by a specific column
T = readtable('test.txt') T = sortrows(T,'ID') G = findgroups(T.ID); S = groupsummary(T,"ID",{"max","sum"},"Number"); S = re...

4 years ago | 0

Answered
I'm trying to convert date numbers to character dates, I created a vector using datenum and manually entering each date in Y,M,D,H,M,S format, and it works but I hope to find
As Steven Lord and Walter Roberson and the MATLAB documentation recommended, you should use DATETIME objects, which can be plott...

4 years ago | 0

Answered
How to select specific files from all the files in a folder?
This is easy using COPYFILE or MOVEFILE with the appropriate wildcard characters, e.g.: P = 'absolute or relative path to where...

4 years ago | 0

| accepted

Answered
Get the position of the max and min values of a variables
[b,index] = maxk(lat1,5); % ^^^^^ the second output is the index

4 years ago | 0

| accepted

Answered
Program to count the number of letters in a character sentence seems to not count the 58th character.
if char(i)==texte(char(j)) % ^^^^^ ^ get rid of this The code could be simplified using HISTCOUNTS, LOWER, etc...

4 years ago | 0

| accepted

Answered
How read the exact number of decimal digits with readtable from a .csv file?
This imports the data as text, converts to numeric for the filter calculation, and then saves the text. Caveat: it does not pres...

4 years ago | 1

| accepted

Answered
From separate channels to RGB
I am guessing that the image files are actually Truecolor RGB (with all channels identical) rather than true Grayscale (a sadly ...

4 years ago | 0

| accepted

Answered
How change unit8 pixel value to intensity data
https://www.mathworks.com/help/matlab/ref/im2gray.html

4 years ago | 1

Answered
Write a Matlab code to check. .. whether a given number is an amstrong number using functions.
N = 153; S = num2str(N); Z = N==sum((S-'0').^numel(S))

4 years ago | 0

Answered
Load data with varying names
The MATLAB documentation explains how: https://www.mathworks.com/help/matlab/import_export/process-a-sequence-of-files.html Th...

4 years ago | 1

| accepted

Answered
NEED TO READ A FILE AND STORE VALUES
I shortened the file a bit by removing some lines from the middle of those data blocks. opt = {'Delimiter','\t', 'CollectOutput...

4 years ago | 1

| accepted

Answered
Sort Matlab table based on pre-defined order
You could do something like this, where C is that column: D = {'B';'A';'C';'D'}; % the desired order C = {'C';'C';'A';'D';'B';...

4 years ago | 0

| accepted

Answered
update a string function in matlab
a = 5; b = [4,5]; sprintf('it has happened %d times in the flight, in the %d and %d second',a,b(1),b(2)) A general solution: ...

4 years ago | 0

| accepted

Answered
extracting files having names with the same date from a dataset
Here is one approach, tested on the attached files: P = '.'; % absolute or relative path to where the files are saved S = dir(...

4 years ago | 0

| accepted

Answered
operation in matrix in matlab
"...i want to know the number of times, a matrix has a value greater than 4." The efficient MATLAB approach: a = [3,4,2,5,3,5]...

4 years ago | 0

Answered
configure display of exponential numbers
format shortEng 1e-10*[0.1270,0.1310,0.1120,0.1480,0.1650]

4 years ago | 1

| accepted

Answered
Read and extract specific values from a textfile
The numeric values below are in two matrices, you can use indexing to extract the t, Gh, etc. vectors. format short G str = fi...

4 years ago | 1

Answered
I'm trying to make a function and my if statement isn't working properly
Assuming that mu is scalar: if a(i) >= mu % ^^^ you need this indexing Note that the MATLAB approach would be to get rid of...

4 years ago | 0

| accepted

Answered
Why sometimes a matlab function is called without input arguments?
"I have seen that matlab function like this function dx = some_name(x, u, p) is called as following model = @some_name;" That s...

4 years ago | 0

| accepted

Answered
Store directory listing into loopable structure
The MATLAB approach: P = 'C:\Users\dbhadra\Desktop\MSD\Sensor Mixing\Pr14 Ryan Data\TC2\RT\Closed_Loop'; S = dir(fullfile(P,'*...

4 years ago | 0

| accepted

Answered
How to remove decimals digits from datetime arrays?
Assuming that the goal is to truncate at some precision (which is totally independent of the FORMAT), then this works: T = date...

4 years ago | 0

| accepted

Answered
Error when converting Matlab time (double) to datetime (raw data captured from RealTerm)
"Why the clock time jumps from '05:01:59.971000000' to '05:01:00.230000000' if the double type times are sequential?" Because y...

4 years ago | 1

| accepted

Answered
How to create 4D matrix with several 3D matrix??
C = {all of your N 3D array in one cell array}; A = permute(cat(4,C{:}),[4,1,2,3]); But it would be simpler and more efficient...

4 years ago | 0

| accepted

Answered
how to parse different sections of text file into separate matrices
TEXTSCAN makes this relatively easy: out = {}; fmt = repmat('%f',1,7); opt = {'CollectOutput',true}; fid = fopen('test.txt')...

4 years ago | 0

| accepted

Answered
Question about using ismembertol function
"The result should show that A has not been found in B... You do not explain why you think that. I am guessing that you misunde...

4 years ago | 2

| accepted

Answered
How to get two arrays from .txt file?
MATLAB does not have ragged arrays, you could import them as vectors, e.g.: format short G str = fileread('arrays2.txt'); tmp...

4 years ago | 1

| accepted

Answered
Loop through field variables named AnB, where n is an arithmetic value
for ii = 1:9 fnm = sprintf('B1N%dFy',ii); Stdwind_pstill.OutputChannels(k).(fnm) end https://www.mathworks.com/help/...

4 years ago | 0

| accepted

Answered
How to split binary cells and convert them to dec?
More efficient than using CELLFUN: C = {'0100101000101000';'0100101000101000';'0100101000101000';'0100101000101000'} V = [4,2,...

4 years ago | 0

Answered
I want to make a time series from 2016/1/1 00:00 to 2016/12/30 00:00 with one hour difference
V = datetime(2016,1,1):hours(1):datetime(2016,12,20); V = V(:)

4 years ago | 1

| accepted

Answered
access multiple csv files from different folder
This should get you started. Because you did not upload any sample files I could not test it, therefore it will probably not wor...

4 years ago | 0

Load more