Answered

how do i count unique cell rows?

I agree w/ Per, use strings since TMW didn't see fit to extend unique to cell arrays and either is far better than char() arrays...

how do i count unique cell rows?

I agree w/ Per, use strings since TMW didn't see fit to extend unique to cell arrays and either is far better than char() arrays...

environ 9 heures ago | 0

Answered

Filter contents of a table

Why are numeric values entered as text/characters? ix=~ismember(str2num(tbl.value),[3 4]); tbl=tbl(ix,:); If the real questio...

Filter contents of a table

Why are numeric values entered as text/characters? ix=~ismember(str2num(tbl.value),[3 4]); tbl=tbl(ix,:); If the real questio...

environ 17 heures ago | 1

| accepted

Answered

How do I use splitapply when the applied function has non-scalar output?

OK, I reread the Q? and realize there was enough in it to see what it was that was wanted... >> t=myTable; ...

How do I use splitapply when the applied function has non-scalar output?

OK, I reread the Q? and realize there was enough in it to see what it was that was wanted... >> t=myTable; ...

environ 17 heures ago | 0

| accepted

Answered

Short Question about Multiple cases in for end

Depends upon what you mean to do...if want each combination of the four variables, then you write a set of nested for loops... ...

Short Question about Multiple cases in for end

Depends upon what you mean to do...if want each combination of the four variables, then you write a set of nested for loops... ...

1 jour ago | 0

| accepted

Answered

Trying to have user input names into matlab and store them in a matrix

Don't use the character array...assignment in it has to be padded to the maximum length for every row in the array. Either use ...

Trying to have user input names into matlab and store them in a matrix

Don't use the character array...assignment in it has to be padded to the maximum length for every row in the array. Either use ...

1 jour ago | 0

Answered

How do I use splitapply when the applied function has non-scalar output?

[A,B,C,...]=splitapply(func, ...); applies func to inputs by group and returns the given outputs... See the doc for details, e...

How do I use splitapply when the applied function has non-scalar output?

[A,B,C,...]=splitapply(func, ...); applies func to inputs by group and returns the given outputs... See the doc for details, e...

1 jour ago | 0

Answered

Swapping entries in column of table

% first build a more workable table arrangement... t=table(str2double(tbl.multicol),'VariableNames',{'array'}); t=t(1:3,:) t ...

Swapping entries in column of table

% first build a more workable table arrangement... t=table(str2double(tbl.multicol),'VariableNames',{'array'}); t=t(1:3,:) t ...

3 jours ago | 1

Answered

How to save a complex matrix as text file?

C (and ergo Matlab) is woefully weak in input/output for complex variables. Should been remedied by TMW from the git-go given M...

How to save a complex matrix as text file?

C (and ergo Matlab) is woefully weak in input/output for complex variables. Should been remedied by TMW from the git-go given M...

4 jours ago | 0

| accepted

Answered

How to print out a cell array inside a cell array

How did you manage to get that so deeply nested? Let's see the code that generated the array and work on it... But, to answer ...

How to print out a cell array inside a cell array

How did you manage to get that so deeply nested? Let's see the code that generated the array and work on it... But, to answer ...

4 jours ago | 0

| accepted

Answered

How to compare variables without if statement

>> assert(3==4,'Mismatch') Mismatch >> assert(3==3,'Mismatch') >> ADDENDUM: Of course, you can make things more interesti...

How to compare variables without if statement

>> assert(3==4,'Mismatch') Mismatch >> assert(3==3,'Mismatch') >> ADDENDUM: Of course, you can make things more interesti...

5 jours ago | 0

Answered

import csv file and use the data in Matlab

The problem is the file has explicit "" for string variables built into it...that overrides what readtable would otherwise do fo...

import csv file and use the data in Matlab

The problem is the file has explicit "" for string variables built into it...that overrides what readtable would otherwise do fo...

6 jours ago | 2

| accepted

Answered

Removing rows - duplicates based on a condition

[~,ia]=unique(A(A.Size==1,1),'first'); B=[A(A.Size==0,:);A([ia+find(A.Size==0,1,'last')],:)]; returns >> B B = 6×3 table ...

Removing rows - duplicates based on a condition

[~,ia]=unique(A(A.Size==1,1),'first'); B=[A(A.Size==0,:);A([ia+find(A.Size==0,1,'last')],:)]; returns >> B B = 6×3 table ...

7 jours ago | 0

Answered

extracting dates within a text

matchstr='LoomingExp'; % string to match c=textread('book1.csv','%s','delimiter',''); % read as...

extracting dates within a text

matchstr='LoomingExp'; % string to match c=textread('book1.csv','%s','delimiter',''); % read as...

7 jours ago | 0

| accepted

Answered

How to write Continue Long Statements on Multiple Lines ?

The ugliness of the C-style formatting string in all its glory exhibited!!! Why TMW didn't go to the trouble to keep Fortran FO...

How to write Continue Long Statements on Multiple Lines ?

The ugliness of the C-style formatting string in all its glory exhibited!!! Why TMW didn't go to the trouble to keep Fortran FO...

8 jours ago | 0

Answered

How to read an excel spreadsheet ignoring text and comments

The venerable xlsread will return numeric, text, and the raw data in separate locations. Probably better is to use the detectIm...

How to read an excel spreadsheet ignoring text and comments

The venerable xlsread will return numeric, text, and the raw data in separate locations. Probably better is to use the detectIm...

11 jours ago | 1

Answered

Storing the positions of neighbouring elements that have specific values.

>> i0=3; j0=4; >> [i,j]=find(~A(i0-1:i0+1,j0-1:j0+1)); >> [i,j] ans = 1.00 1.00 2.00 ...

Storing the positions of neighbouring elements that have specific values.

>> i0=3; j0=4; >> [i,j]=find(~A(i0-1:i0+1,j0-1:j0+1)); >> [i,j] ans = 1.00 1.00 2.00 ...

11 jours ago | 0

| accepted

Answered

Averaging setions of a matix

mnA=cell2mat(arrayfun(@(n)mean(A(1:n,:)),[2:size(A,1)].','uni',0));

Averaging setions of a matix

mnA=cell2mat(arrayfun(@(n)mean(A(1:n,:)),[2:size(A,1)].','uni',0));

11 jours ago | 0

| accepted

Answered

What exactly is happening in this line of code speech_out = speech(1:1/1.01964:length(speech),:);?

MATLAB rounds to nearest integer for the fractional subscript for indexing. Not recommended technique, use the Signnal Processi...

What exactly is happening in this line of code speech_out = speech(1:1/1.01964:length(speech),:);?

MATLAB rounds to nearest integer for the fractional subscript for indexing. Not recommended technique, use the Signnal Processi...

13 jours ago | 1

Answered

Sort function does not return correct indices

870 is not wrong... -7.2 (1) < -6.2 (3) neither is 884. 884 -15.89 18.31 -10.21 18.31 -10.21 -15.89 2 3 1 ...

Sort function does not return correct indices

870 is not wrong... -7.2 (1) < -6.2 (3) neither is 884. 884 -15.89 18.31 -10.21 18.31 -10.21 -15.89 2 3 1 ...

14 jours ago | 1

| accepted

Answered

Could someone please help me setup an interpolation script to find atmospheric conditions at various altitudes?

function [T, P, rho] = standard_atm(alt) ... % alt sigma delta theta temp press dens a visc k...

Could someone please help me setup an interpolation script to find atmospheric conditions at various altitudes?

function [T, P, rho] = standard_atm(alt) ... % alt sigma delta theta temp press dens a visc k...

14 jours ago | 0

| accepted

Answered

How to overlap time vectors and plot in multiple axis ?

See FEX https://www.mathworks.com/matlabcentral/fileexchange/1017-plotyyy

How to overlap time vectors and plot in multiple axis ?

See FEX https://www.mathworks.com/matlabcentral/fileexchange/1017-plotyyy

16 jours ago | 0

Answered

Change width on fitted line in function fitlm

Yeah, save the handles returned by plot for the linear model fit... mdl=fitlm(T(Index,3),F); hMDL=plot(mdl); hFIT=findobj(hMD...

Change width on fitted line in function fitlm

Yeah, save the handles returned by plot for the linear model fit... mdl=fitlm(T(Index,3),F); hMDL=plot(mdl); hFIT=findobj(hMD...

17 jours ago | 0

| accepted

Answered

Identifying x value at y on an xy plot

P=0.5; % P to find iy=find(y>P,1); % first point past P xp=interp...

Identifying x value at y on an xy plot

P=0.5; % P to find iy=find(y>P,1); % first point past P xp=interp...

17 jours ago | 0

Answered

How to built a histogram in MatLab as Excel did it?

y=[14;21;14;9;16;10;16]; bar(y) That's a bar plot, not histogram.

How to built a histogram in MatLab as Excel did it?

y=[14;21;14;9;16;10;16]; bar(y) That's a bar plot, not histogram.

17 jours ago | 0

| accepted

Answered

How to use a code to get the corresponding value of a loop in another file

Your outer loop range is 0:45:360 but you only set a value for the struct environment for those values less than 360. What is i...

How to use a code to get the corresponding value of a loop in another file

Your outer loop range is 0:45:360 but you only set a value for the struct environment for those values less than 360. What is i...

18 jours ago | 0

| accepted

Answered

trapz whe x is a matrix

TMW only implemented variable X spacing for the full array, not by column (or row). Have to loop to do it...worthy of an enhanc...

trapz whe x is a matrix

TMW only implemented variable X spacing for the full array, not by column (or row). Have to loop to do it...worthy of an enhanc...

18 jours ago | 0

| accepted

Answered

Weekly Average per Year For Loop

No loops should be needed. If you haven't convert the date data to ML datetime and then compute the grouping variable wkyr as ...

Weekly Average per Year For Loop

No loops should be needed. If you haven't convert the date data to ML datetime and then compute the grouping variable wkyr as ...

22 jours ago | 0

Answered

Begginer's Question about matrixes

press=Ps*(1+(Lb/Ts)*altitude).^(-g0*M/R*Lb); dp=diff(press); "The Matlab way" is to use the vectorized abilities built into op...

Begginer's Question about matrixes

press=Ps*(1+(Lb/Ts)*altitude).^(-g0*M/R*Lb); dp=diff(press); "The Matlab way" is to use the vectorized abilities built into op...

22 jours ago | 0

| accepted

Answered

Function doesn't return a vector from a vector input

Yes, you didn't read about logical IF if Ffork0+Inc_Ffork*t <= Ffork_max is True iff every element of Ffork0+Inc_Ffork*t is <=...

Function doesn't return a vector from a vector input

Yes, you didn't read about logical IF if Ffork0+Inc_Ffork*t <= Ffork_max is True iff every element of Ffork0+Inc_Ffork*t is <=...

22 jours ago | 1

Answered

Unspecified coefficients from function 'fit'

fit returns a fit object (either cfit or sfit, depending on curve or surface). There are functions to return things out of the ...

Unspecified coefficients from function 'fit'

fit returns a fit object (either cfit or sfit, depending on curve or surface). There are functions to return things out of the ...

25 jours ago | 0