Answered
constructing a difficult large matrix
Here are three functions, two of which are based on the answer of David Goodmanson. I think all of them are fast enough. However...

alrededor de 2 meses ago | 1

Answered
Randomly convert exact number of 1 to 0 in binary matrix
Try %% x = [ 0 1 0 1 0 1 1 1 1]; %% ix_one = find( x == 1 ); ix_set_zero = randi( numel(ix_one), 1,2 ); x( ...

alrededor de 2 meses ago | 0

| accepted

Answered
number permutate without permutation
Steps to find a substitute for perms without perms Lookup perms in the documenttion, perms, All possible permutations See "Se...

alrededor de 2 meses ago | 0

Answered
is 2GB RAM ok for MATLAB 2020 ?
Yes, you don't need to install Polyspace, but plain Matlab requires a minimum of 4GB. See System Requirements for MATLAB R2020a

alrededor de 2 meses ago | 0

| accepted

Answered
Storing data from a loop
Pre-allocate Y1 and Y2 Assign to elements of Y1 and Y2 Do not change the loop counter, ii, in the loop The documentation say...

alrededor de 2 meses ago | 0

Answered
I am having problems with my homework:Write a function called valid_date that takes three positive integer scalar inputs year, month, day....
Replace (rem(year,4)==0 && rem(year,100)~=0) || (rem(year,400)==0 && rem(year,100)~=0) by (rem(year,4)==0 && rem(year,100)~=...

alrededor de 2 meses ago | 0

Answered
cellfun vs. varfun applied to column of table
This works, but may contain more code than you hoped for. %% T = table({'147956, 154414'; '1, 7439'; '93053, 101815'; '50151, ...

alrededor de 2 meses ago | 1

Answered
OPP using any algorithm
Did you check YALMIP and MATPOWER ?

alrededor de 2 meses ago | 0

Answered
Continuing an input function onto another line
The documentation says; The start and end quotation marks for a character vector must appear on the same line. For example, thi...

alrededor de 2 meses ago | 0

Answered
export codes written in editor into word
See Bring along your syntax highlighted code and M2HTML: Documentation System for MATLAB in HTML

alrededor de 2 meses ago | 1

| accepted

Answered
Transaction Data in HTML file
This is a start %% sad = dir( 'd:\m\cssm\transData*.txt' ); len = length( sad ); out = cell( len, 2 ); for jj = 1 : len ...

alrededor de 2 meses ago | 0

| accepted

Answered
Textscan with '@' as delimiter
I've reproduced your result on R2018b. The result is according to the textscan documentation - I think. out1 is a cell array of...

2 meses ago | 0

| accepted

Answered
Converting txt file into title and array?
Try this %% fid = fopen( 'cssm.txt', 'rt' ); xL = fgetl( fid ); % read the first line data = fscanf( fid, '...

2 meses ago | 0

| accepted

Answered
Updating a Property in an Array of Objects
The documentation doesn't tell that a statement like [WorkOrder(1,:,1).nid] = listData.nid(:,1); isn't possible. You are not t...

2 meses ago | 0

| accepted

Answered
apply function to all fields in a structure array
Another mix of structfun and arrayfun >> max( cell2mat( arrayfun( @(S) structfun( @(f) f, S.F1 ), sa, 'uni',false ) ), [], 2 ) ...

2 meses ago | 0

| accepted

Answered
Preallocation of a matrix: how to shrink it afterwards?
Something like this fullstate = class_of_state( size(epochn) ); for t = reshape( epochn, 1,[] ) idx = find(epochn == t); ...

2 meses ago | 0

Answered
How to read only some columns of a text file?
The text file might have more than 7 coloums. Replace '%*n %*n %n %n %n %n %n' by '%*s%*s%n%n%n%n%n%*[^\n]' %*[^\n]' ski...

2 meses ago | 0

Answered
how to control the length of indexed array element?
"(from 1 to the last bit of m(i)) " Here is my shot in the dark %% m = uint8([1,2,3,4]); len = length(m); m_d = 0.5*...

2 meses ago | 0

| accepted

Answered
anonymous function with a variable number of input variables
"anonymous function with a variable number of input variables" Something like this? >> ht(1,2,3) ans = 6 >> ht(1,2,3,4...

2 meses ago | 1

Answered
How to read spreadsheet files iteratively?
Replace readtable('filename.xls'); by readtable( [ filename, '.xls' ] ); to use the value of the variable not its name.

2 meses ago | 1

| accepted

Answered
How to use R2020a import tool to upload multiple excel files
YES! See Import or Export a Sequence of Files and How can I process a sequence of files?

2 meses ago | 1

Answered
convert matrix data to cell array data
Try this >> num2cell( magic(5), 1 ) ans = 1×5 cell array Columns 1 through 4 {5×1 double} {5×1 double} {5×1 d...

2 meses ago | 0

| accepted

Answered
how do I store an array of functions?
An error message tells me Nonscalar arrays of function handles are not allowed; use cell arrays instead. Is this what are loo...

2 meses ago | 0

Answered
How to get drive name?
On Windows this function works with my local drives >> DriveName( 'C' ) ans = 'OSDisk' >> DriveName( 'D' ) ans = '...

2 meses ago | 1

| accepted

Answered
Getting error about index in for loop
Three problems: replace 0:size(dataN) by 1:size(dataN,2). Matlab's indexing is one-based. avg = mean(val); overwrites avg in e...

2 meses ago | 0

Answered
Optimizing code run time
Try to replace M = load(fullfile(path,'M.mat')); by persistent M if isempty(M) M = load(fullfile(path,'M.mat')); end ...

2 meses ago | 0

| accepted

Answered
How to Keep Nested For Loop Indexes From Equaling Each Other
for ii=1:50 for jj=1:50 if not(jj==ii) code end end end See i, Imaginary unit

2 meses ago | 0

Answered
How can i store data in a cell array with single row and few number of columns?
Pre-allocate ACC before the for-loop ACC = cell( 1, 20 ); replace all ACC{a,1} by ACC{a}

2 meses ago | 0

Answered
New class object every iteration
In most cases it's better to create an array of objects. The documentations provides one way. See Construct Object Arrays. Wha...

2 meses ago | 0

| accepted

Answered
My home tab and command line are missing in MATLAB 2019b
Your screen shows an undocked Matlab Editor - I think. Notice the icon in the upper left corner here is a screen clip from an...

2 meses ago | 0

| accepted

Load more