Réponse apportée
How to divide a 400x800 matrix to 8x8 blocks?
M = rand(400,800); [R,C] = size(M); C = mat2cell(M,8*ones(1,R/8),8*ones(1,C/8))

plus de 2 ans il y a | 0

Réponse apportée
I have a matrix. I want to count number of only those zeros which are lying between 2 sets of consecutive nonzero values on each side. How to do? Desired result given below
A general solution requires that: the 3rd value should be empty. therefore e.g. a container array needs to be used. Consider ...

plus de 2 ans il y a | 0

Réponse apportée
Increase the number of elements inside a cell
No loop, no concatenation required: A = {'5';'11'}; B = {'7';'19'}; out = [A,B]; % cell 2x2 parameter = 4; out(:,end+1:para...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Splitting Table Based on One Column Value
Use the correct type of indexing. Curly braces returns the table content, not another table: https://www.mathworks.com/help/mat...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
How to extract multiple excel tabs into MATLAB
Do not use deprecated XLSREAD. It is very odd that your filename does not have a file extension, I fixed that for you: F = 'C:...

plus de 2 ans il y a | 1

Réponse apportée
How to create new rows in a table based on nested cell arrays of different sizes
This is MATLAB, so do not use on concatenation within loops to achieve this task. Better: S1 = load('file.mat'); S2 = load('fi...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
unpack cell array of letters to be plugged into individual-cell rows, in a vector
Why are you storing numeric data as text? That must make data processing very awkward: most likely better data design would be t...

plus de 2 ans il y a | 1

Réponse apportée
Comparing two tables and replacing categorical column, row wise.
Why are you using a loop for this? MATLAB works best when you work in terms of vectors, matrices, and arrays: T1 = array2table(...

plus de 2 ans il y a | 0

Réponse apportée
Need help on the array of matrix.
B = reshape(A,3,[]).'

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
How to add extension to files using MATLAB
According to a comment you made in another thread, the files have no file extension. The first thing is to check if that is real...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
convert a column matrix with many rows into multiple column of equal rows
A = [1;3;2;4;5;8;7;6;12;10] B = reshape(A,[],2) B = [1,8;3,7;2,6;4,12;5,10]

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Inquiry about ceil function.
"I understand what ceil function does, however I do not understand why is necessary to sum + 1E-12" In lieu of useful code comm...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
create matrix (rx1) with the data obtained from the for loop
"Maybe it is because there are numbers in the name field (not in sequence)? I don't think so." Yes, it is exactly because of th...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Suppose i have a matrix (2x4) A=[1 2 3 4;5 6 7 8] and i want to change it into this matrix [1 2;3 4;5 6;7 8]. How to do that?
When using MATLAB you will do these kind of things quite often. Understand the order of data stored in memory: https://www.math...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
combine cells with different size
a = {'ball' , 'cake' , 'ice'}; b = {'home'}; c = {'car','moto'}; d = {'money'}; e = cell(4,0); e(1,1:numel(a)) = a; e(2,1:...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
only consider fields that exist within a structure
Generally it is easier to keep data together, rather than split it apart. Do not "extract" all of the fields to separate variabl...

plus de 2 ans il y a | 0

Réponse apportée
why readtable create field "D" in the struct "D1"
If there is only one variable in the MAT file (regardless of its extension) and you do not know/care what its name is: C = stru...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Dividing a Square Matrix into Four Distinct Matrices Based on indexing element as well as the last digit
Simpler and more efficient. My answer takes into account my comments here. Assumes no zero, negative, fractional, inf, etc. val...

plus de 2 ans il y a | 1

Réponse apportée
Write values of large cell to .inp file
Do not use nested loops! Your approach mixes up nested loops and a format string that prints each line. Better: fmt = repmat(',...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
how to create for loop in below formula
Your inefficient approach (with anti-pattern numbered variable names): LP1 = rand; LP2 = rand; LP3 = rand; LP4 = rand; LP5 ...

plus de 2 ans il y a | 0

Réponse apportée
Expanding current code to be used on folder of these file types, and changing strings into numbers per file.
Download SIP2NUM from here: https://www.mathworks.com/matlabcentral/fileexchange/53886-scientific-prefix-to-number (this code ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How to plot weeknumbers (integers) in a graph without leaving gaps for weeks that do not exist
This turns out to be surprisingly difficult without DATETIME et al supporting ISO 8601 weeknumbers. The rules for ISO 8601 week...

plus de 2 ans il y a | 0

Réponse apportée
vertcat errors - need a 'workaround' solution
S = load('datatables.mat') T1 = S.C1; T2 = S.R1; C1 = categories(T1.ImpactWind) C2 = categories(T2.ImpactWind) C0 = unique(...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
export structs within structs
So many nested scalar container arrays: this is very inefficient data design. Much better would be e.g. one non-scalar structure...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
im struggling with this one guys like the oddsum and the rest is undefeatable with me
N = 'S2307605'; % must be character V = N(2:end)-'0' R = rem(sum(3*V(1:2:end))+sum(V(2:2:end)),11) S = struct('S','A':'K','G'...

plus de 2 ans il y a | 0

Réponse apportée
split struct based on description
C = {S.SeriesDescription}; S_scout = S(strcmpi(C,'Scout')) S_serie = S(strcmpi(C,'Serie')) S_stand = S(strcmpi(C,'Standard'))...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
select, only once, the names present in a struct
C = unique({S.SeriesDescription}) https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html https://www.mat...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Load data as structure in Matlab App Designer
Here is a simple way to convert the output from UIGETFILE to a non-scalar structure similar to that returned by DIR: [F,P] = ui...

plus de 2 ans il y a | 0

Réponse apportée
create a struct with two columns
"How can I do it?" S = struct([]); for k = 1:7 name_char % = '0001'; folder_char %= 'C\.....'; S(k).name = nam...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Read files in a folder with dates on them
The actual solution is to parse the filenames that you gave. Lets create some fake files with fake data: X=1;save Profile_1990_...

plus de 2 ans il y a | 1

| A accepté

Charger plus