Answered
Compare classes with different Properties
Try this %% Create sample data mc(20) = MyClass; [mc(1:7).a] = deal(1); [mc(8:20).a] = deal(2); %% Desired output edges =...

alrededor de 1 mes ago | 0

| accepted

Answered
Why can't a concrete subclass use size and validator functions on abstract superclass properties?
The R2019b doc on Validate Property Values says [...] Abstract Property Validation You can define property validation for ab...

alrededor de 1 mes ago | 0

Answered
save obj creates a large mat files, disagrees with whos
"Once I have reached the 2GB data size format v7 will no longer work." ??? Doc on save v7 says: 2^31 bytes per variable Ex...

alrededor de 1 mes ago | 0

Answered
why does my m file not save correctly
The command save is used to store variables of the current workspace, i.e. save data. There is no simple command to save m-code...

alrededor de 2 meses ago | 0

Answered
Why does converting a table to a struct increase memory usage by 15x??
What kind of structure do you expect? table2struct can create two kinds. struct array with one struct for each row of the tab...

alrededor de 2 meses ago | 1

Answered
How to load text file to workspace variables?
"load to workspace as variables with string name in var and numeric value as val." There need to be a really good reason to do ...

alrededor de 2 meses ago | 0

Answered
how to produce a logical matrix using index matrix
Try logical_matrix = false( 1, 4 ); logical_matrix( b ) = true;

alrededor de 2 meses ago | 1

| accepted

Answered
Error using - Matrix dimensions must agree.
I get a different error. One reason for the difference in the wording is that we run different releases of Matlab(?). I run R201...

alrededor de 2 meses ago | 0

| accepted

Answered
Varargout - How to realize function call
varargout exercise. Try something like this function varargout = test( j, k ) out1= nargin; out2 = j-k; if out2 ...

alrededor de 2 meses ago | 0

Answered
How many times does each combination of numbers appear?
"get it to tell" depends on what the little word "it" refers to. The function randi() cannot tell that. Try this as a start %...

alrededor de 2 meses ago | 0

| accepted

Answered
How do I save each iteration of a loop into a matrix?
Replace for i=0:n c=circshift(p, [0, i]); end by c = nans(n,1); for i=0:n c(i)=circshift(p, [0, i]); end

alrededor de 2 meses ago | 0

Answered
Using Load in a test methods makes the test pass
Looks like a bug to me, however in programs one ought to use the functional form S = load('matlab.mat'); In that case the test...

alrededor de 2 meses ago | 0

Answered
Trouble reading the file with strread and textscan
"Illegal use of reserved keyword "end". " Deleting some code may leave a spurious end sometimes far to the right outside the ...

alrededor de 2 meses ago | 0

Answered
Loop for sequence of text files
See How can I process a sequence of files?

2 meses ago | 0

Answered
How to perform operations depending on a value in an array
This works accourding to your expectations - I think. %% C=[10,8,34,7,7,24,11,15,10,13,13,20,17,39,6,9,5,21]; data=2200; for...

2 meses ago | 0

| accepted

Answered
Change folder vs change directory
Matlab issues the message that you refer to in "Change folder is the option that sometimes matlab ask before running the script"...

2 meses ago | 0

Answered
How can I save data from features files into matrix?
I understand that "data for each feature for 500 images" is in ONE text file with 500 blocks of six rows. The format is illust...

2 meses ago | 0

| accepted

Question


Regular expression. Are nesting of group operators supported?
Regarding Grouping Operators the function, regexp, doesn't behave the way I expected. >> cac = regexp( 'ABC', '((A)(B(C)))'...

2 meses ago | 1 answer | 2

1

answer

Answered
Question about column operator vectors
Doc says x = j:k creates a unit-spaced vector x with elements [j,j+1,j+2,...,j+m] ... x = j:i:k creates a regularly-sp...

2 meses ago | 0

| accepted

Answered
how to run function 1000 times to find minimum
Something like S = struct( 'score', cell(1,1000), 'grouping', cell(1,1000) ); for jj = 1 :1000 S(jj).grouping = randomize...

2 meses ago | 1

| accepted

Answered
Rename and save multiple .mat files.
"the name on the work space is the old name" What do you expect? It's the names of the variables contained in the mat-file. The...

2 meses ago | 0

Answered
How to extract text from string at the same location, one line above
"Is there a better/more efficient way of achieving this?" No, I don't think so. However, speed depends on how "each line for ea...

2 meses ago | 0

| accepted

Answered
Replace odd numbers with infinity
%% C = randi([100,200],3,6) is_odd = rem(C,2) == 1; D = C; D( is_odd ) = inf returns C = 117 103 107 159 122 ...

2 meses ago | 0

| accepted

Answered
Using dir() without changing directory?
Use an absolute path rather than a relative path (as proposed in the comments). It's easier to get it right. Thus try sad = di...

2 meses ago | 0

Answered
how can I read file from a different directory
If you know the full directory name of 'b' use that, i.e chr = fileread( fullfile( 'c:', 'full', 'directory', 'name', 'of', 'b'...

2 meses ago | 1

| accepted

Answered
creating a matrix in matlab using a text file
It's the brackets, [], that confuses Matlab. Try A = readmatrix( 'output.txt', 'Whitespace',' []' ); I have R2018b so I can'...

2 meses ago | 1

| accepted

Answered
Nested for loop not iterating
I'm just guessing. Replace a_p = agrid(i) b_p=bgrid(j); fhat(i,j)=(a_p(i))-(b_p(j)).*magrange; by fhat(i,j) = ( agrid(i) - ...

2 meses ago | 0

Answered
Previously accessible file is now inaccessible
You need to close the file after reading, add fclose( fileID ) after filedata = textscan(fileID, '%s %s %s %s %s %s %s %s')...

3 meses ago | 0

| accepted

Answered
How to convert all the rows containing char values to numbers in a table without for loop?
Replacing str2num by str2double might help. str2num uses eval(), which is slow. str2double takes arrays as input. %% cac =...

3 meses ago | 0

Answered
How to extract a vector from a matrix and save in workspace?
"can I use them in a loop using their names" NO but you can loop over the columns of the matrix for jj = 1 : size( M, 1 ) ...

3 meses ago | 0

| accepted

Load more