Answered
how to remove rows and columns in cell array ?
Where C is your cell array: C(25419:29317,:) = []; You could also detect those rows automatically: X = all(cellfun(@isempty,C...

17 Tage ago | 1

| accepted

Answered
Passing variable from anonymous objective function to main workspace
You can do this easily with nargin: function val = objfun(x,v1,v2) persistent data if ~nargin val = data; return e...

18 Tage ago | 0

Answered
complex repeating input format
fmt = repmat('%f%s%s%s%s',1,97); fmt = ['%s%f%f%f%f%s',fmt]; Note that you wrote "First 5 columns..." but your example format ...

18 Tage ago | 1

| accepted

Answered
Convert a fixed width char array into a column vector
This will be quite efficient: >> aa = ' 1703434 42 1012275140184521401845314018473'; >> vec = sscanf(sprintf('%c%c%c%c%c%...

18 Tage ago | 1

Answered
convert 1x1 Cell with scientific number as text to a number in MATLAB.
Just use the correct indexing for accessing the contents of a cell array: E1 = T{1,2}; https://www.mathworks.com/help/matlab/m...

18 Tage ago | 0

| accepted

Answered
Callback Push Button Execution
"...and to me I originally thought one of these two should have happened..." What actually occurs is described in the MATLAB do...

19 Tage ago | 0

| accepted

Answered
Converting a 2d matrix into a 3d matrix
Depending on how you want them arranged in the new array, either test1 = reshape(test,4,6,10); or test1 = permute(reshape(tes...

19 Tage ago | 0

| accepted

Answered
Error: EXTRAPVAL must be a scalar
According to the interp2 documentation, the extrapval must be a scalar numeric: https://www.mathworks.com/help/matlab/ref/inter...

19 Tage ago | 0

| accepted

Answered
Extract a column of a matrix created by a command
MATLAB does not generally support indexing** directly into the output of functions or operations. The usual solution is to alloc...

19 Tage ago | 0

Answered
vertically concatenate struct values from the same field
V = vertcat(S1.vals) V = vertcat(S1(1:10).vals) https://www.mathworks.com/help/matlab/matlab_prog/comma-separated-lists.html ...

19 Tage ago | 0

| accepted

Answered
Using fprintf to display multiple strings
Very simply add an identifier to the format specifier: fprintf('%1$s + %1$s',char(955)) % ^^ ^^ input...

20 Tage ago | 0

Answered
imshow() black for max value and white for min value?
Assuming that the image array A contains values in the range 0-1: imshow(1-A)

23 Tage ago | 0

| accepted

Answered
How to accelerate the process of `find` in large for loop ?
>> [X,Y] = ismember(A,B); >> [~,Z] = sort(Y(X)); >> V = find(X); >> R = reshape(V(Z),2,[]).' R = 2 9 4 8 5 ...

24 Tage ago | 0

| accepted

Answered
Storing integers from a cell in a variable
Much more efficient than cellfun: >> C = {'(4,4)';'(3,4)';'(2,4)';'(1,4)';'(0,4)';'(-1,4)';'(-2,4)'}; >> V = sscanf([C{:}],'(%...

24 Tage ago | 1

| accepted

Answered
Unable to perform assignment with 0 elements on the right-hand side.
The actual problem is that you think that one (or more) of these values match: app.AccelSNEditField == mergetables{:,1} In fac...

26 Tage ago | 1

Answered
Error with Uniquetol: " Repetitive numbers not being removed"
Set the tolerance to a suitable value, e.g.: >> uniquetol(GlobalNMesh,1e-3) ans = 0 0.0336 0.1199 0.1331

27 Tage ago | 0

| accepted

Answered
Combining matrices from workspace or from directory into a single matrix.
Assuming that each .mat file contains exactly one array with compatible sizes: D = 'path to the directory where the files are s...

29 Tage ago | 1

| accepted

Answered
mapping of datas in -pi to pi to 0 to 2*pi
mod(data,2*pi)

29 Tage ago | 0

Answered
Extracting a specific digit from a float w/o floating-point implementation rounding issues
Some people will incorrectly tell you that this is not possible, but in reality there is a simple and efficient solution: >> N ...

30 Tage ago | 0

| accepted

Answered
Folder / File Loop
D = 'path to the parent folder where the sub folders are'; S = dir(fullfile(D,'*')); F = {S([S.isdir]).name}; for ii = 1:nume...

etwa ein Monat ago | 0

Answered
How to replace a word with another word in a cell array (case insensitive)
Method one: loop and regexprep: for k = 1:numel(withthis) str = regexprep(str,replaceword,withthis{k},'once','ignorecase')...

etwa ein Monat ago | 1

| accepted

Answered
How can I add data to an existing array when the dimension do not agree?
Just use indexing to specify how many elements you are allocating to. MATLAB will expand the array to fit: >> B = ['ABC';'DEF']...

etwa ein Monat ago | 0

| accepted

Answered
cell2mat Error :using cat Dimensions of arrays being concatenated are not consistent.
%P2 = {0,[1;2];0,0}; % test data P2 = Numerical_FourierForce{1,1}; X = cellfun(@(a)isequal(a,0),P2); P2(X) = {[0;0]}; P2 = c...

etwa ein Monat ago | 0

| accepted

Answered
Breaking data from a large text file into groups
"I just need to determine the group with the highest number of elements and output that list only." So for your example data th...

etwa ein Monat ago | 1

Answered
How to convert string to datetime format in parquet file format within parquet datastore?
>> D = {'2020/1/1' ;'2020/1/1' ;'2020/1/1' }; >> T = {'00:01:0:0';'00:01:0:60';'00:01:0:320'}; Method one: sscanf and durat...

etwa ein Monat ago | 0

| accepted

Answered
Sorting specific dates from Datetime array
This is easy using datetime and days: >> vd = linspace(days(-2),days(2),10); >> dt = datetime+vd(:) dt = 12-Jul-2020 00:...

etwa ein Monat ago | 0

Answered
Sort rows of a matrix based on a specific array
>> [X,Y] = ismember(A(:,1),B); >> [~,Z] = sort(Y(X)); >> T = A(X,:); >> A(X,:) = T(Z,:) A = 3 1 1 2 0 0 ...

etwa ein Monat ago | 1

| accepted

Answered
How to use metacharacters in combination with cell arrays to build up a pattern for regexp?
"my goal is to get the max index of occurence of the string "22" with no other digits or characters before or after it." I assu...

etwa ein Monat ago | 0

| accepted

Answered
Why did I get different print format in the output txt file?
"I am wondering why the alignment of columns when using my old Dell are Not as good as those when used my iMac and new dell." T...

etwa ein Monat ago | 1

| accepted

Answered
Giving a Different Value to Elements of Array
Using numbered variables is a sign that you are doing something wrong. In this case, using indexing would allow you to use a lo...

etwa ein Monat ago | 0

| accepted

Load more