Answered

Issues with plotting/best method

I added 'd' to all your plot-commands plot(b0(1,1), z(1,1), 'd' ) keyboard hold on plot(t0(1,1), z(2,1), 'd' ) plot(b1(1,1)...

Issues with plotting/best method

I added 'd' to all your plot-commands plot(b0(1,1), z(1,1), 'd' ) keyboard hold on plot(t0(1,1), z(2,1), 'd' ) plot(b1(1,1)...

1 día ago | 0

Answered

Organizing images in datastore and accessing them with parameters

The statement imds = imageDatastore(location) creates an instance of the class, ImageDatastore. My first idea was to subclas...

Organizing images in datastore and accessing them with parameters

The statement imds = imageDatastore(location) creates an instance of the class, ImageDatastore. My first idea was to subclas...

4 días ago | 0

Answered

Brace indexing is not supported for variables of this type.

"How do I call the sort_nat function to sort folders?" Examples Find sorted file names >> sad = dir('d:\m\cssm\*.txt'); >> ...

Brace indexing is not supported for variables of this type.

"How do I call the sort_nat function to sort folders?" Examples Find sorted file names >> sad = dir('d:\m\cssm\*.txt'); >> ...

8 días ago | 0

Answered

understanding "<" operator line

Consider the two lines midCirc = X.^2+Y.^2 < (1/n)^2; NmidCirc = not(midCirc); The first line assigns a logical value (true/f...

understanding "<" operator line

Consider the two lines midCirc = X.^2+Y.^2 < (1/n)^2; NmidCirc = not(midCirc); The first line assigns a logical value (true/f...

9 días ago | 0

Answered

Searching for a matched string within nested cell and delivering the index

Assume there is ONE cell contaning 'TOTAL' Try %% ix = find( cellfun( @(cac) strcmp(cac{1},'TOTAL'), values ) ); num = value...

Searching for a matched string within nested cell and delivering the index

Assume there is ONE cell contaning 'TOTAL' Try %% ix = find( cellfun( @(cac) strcmp(cac{1},'TOTAL'), values ) ); num = value...

11 días ago | 0

| accepted

Answered

Take average of multiple matrices

Try this %% load('data.mat') num = cat( 3, phi_BFD_v_sum{:} ); avg = mean( num, 3 ); peek >> avg avg = 0 ...

Take average of multiple matrices

Try this %% load('data.mat') num = cat( 3, phi_BFD_v_sum{:} ); avg = mean( num, 3 ); peek >> avg avg = 0 ...

11 días ago | 1

Answered

Pre-allocating cell containers

"I have pre-allocated memory". After pre-allocating memory for a variable you must not change its size. If you do, the effect o...

Pre-allocating cell containers

"I have pre-allocated memory". After pre-allocating memory for a variable you must not change its size. If you do, the effect o...

11 días ago | 0

Answered

how to save the outputs obtained by a for loop repeated n times

tot is overwritten in each iteration of the for-loop Replace tot = (Tin{idx(:,i),i+1:i+3}); by tot(:,i) = (Tin{idx(:,i),i+...

how to save the outputs obtained by a for loop repeated n times

tot is overwritten in each iteration of the for-loop Replace tot = (Tin{idx(:,i),i+1:i+3}); by tot(:,i) = (Tin{idx(:,i),i+...

14 días ago | 0

| accepted

Answered

Kill a system process if it takes too long

I did this long time ago and have forgotten the details. And I haven't access to my code now. Thus from the top of my head. Ther...

Kill a system process if it takes too long

I did this long time ago and have forgotten the details. And I haven't access to my code now. Thus from the top of my head. Ther...

17 días ago | 1

Answered

Counting in one column that is conditional on another column

Does this do what you look for? %% limits = { [0;4], [4;5], [5;6], [6;7], [7;inf] }; %% some simple test data trials = {[ ...

Counting in one column that is conditional on another column

Does this do what you look for? %% limits = { [0;4], [4;5], [5;6], [6;7], [7;inf] }; %% some simple test data trials = {[ ...

17 días ago | 0

| accepted

Answered

How to change data in a cell array of doubles?

??? "doing time = time - 1" doesn't "fix the time so that it starts from 0" Try this >> load('trials.mat') >> cac = cellf...

How to change data in a cell array of doubles?

??? "doing time = time - 1" doesn't "fix the time so that it starts from 0" Try this >> load('trials.mat') >> cac = cellf...

19 días ago | 1

| accepted

Answered

Fprintf not inserting new line correctly with /n

The documentation of fprinf says fprintf(formatSpec,A1,...,An) applies the formatSpec to all elements of arrays A1,...An i...

Fprintf not inserting new line correctly with /n

The documentation of fprinf says fprintf(formatSpec,A1,...,An) applies the formatSpec to all elements of arrays A1,...An i...

19 días ago | 1

| accepted

Answered

convert string to equation

Or a smelling solution if you don't have the symbolic toolbox >> x=3; >> v = eval('(5*x^2)') v = 45 >> Create an ano...

convert string to equation

Or a smelling solution if you don't have the symbolic toolbox >> x=3; >> v = eval('(5*x^2)') v = 45 >> Create an ano...

19 días ago | 0

Answered

Find the value at exact location in a text file

An alternative construct based on ismembertol(). I believe it's faster. %% fid = fopen( 'cssm.txt', 'rt' ); % cssm.txt conta...

Find the value at exact location in a text file

An alternative construct based on ismembertol(). I believe it's faster. %% fid = fopen( 'cssm.txt', 'rt' ); % cssm.txt conta...

20 días ago | 0

Answered

MATLAB not displaying answer correctly in command window

Look up the help on format specifier of fprintf(). Next replace the spec, %s, in your %%Display section by %+7.2f The tripl...

MATLAB not displaying answer correctly in command window

Look up the help on format specifier of fprintf(). Next replace the spec, %s, in your %%Display section by %+7.2f The tripl...

20 días ago | 0

| accepted

Answered

Convert imported data from table to array

See table2array - Convert table to homogeneous array

Convert imported data from table to array

See table2array - Convert table to homogeneous array

21 días ago | 0

| accepted

Answered

Help placing user input into an element in a row vector

Look up for in the documentation ... replace for i = 1 < score by for i = 1 : data

Help placing user input into an element in a row vector

Look up for in the documentation ... replace for i = 1 < score by for i = 1 : data

22 días ago | 0

Answered

Putting three separate arrays into one new array

Try NewArray = [array1, array2, array3]; or NewArray = horzcat(array1, array2, array3); instead

Putting three separate arrays into one new array

Try NewArray = [array1, array2, array3]; or NewArray = horzcat(array1, array2, array3); instead

24 días ago | 1

| accepted

Answered

2 columns put together

One way >> c = [x,y]; % concatenate x and y horisontally >> c(2,:) % second row ans = 0.585 0.4926 >>...

2 columns put together

One way >> c = [x,y]; % concatenate x and y horisontally >> c(2,:) % second row ans = 0.585 0.4926 >>...

24 días ago | 0

Answered

How to extract certain values from an array

First see Array Indexing and Find Array Elements That Meet a Condition. Then try >> x=[8,5,5,5,9,4,3,2,9,10]; >> new = x(x<7) ...

How to extract certain values from an array

First see Array Indexing and Find Array Elements That Meet a Condition. Then try >> x=[8,5,5,5,9,4,3,2,9,10]; >> new = x(x<7) ...

25 días ago | 0

| accepted

Answered

How can I change an element in a matrix with the median of itself and its surrounding elements.

"but I do not know how to specify the median function to take the localized 3x3 matrix of a larger array" Combine these two e...

How can I change an element in a matrix with the median of itself and its surrounding elements.

"but I do not know how to specify the median function to take the localized 3x3 matrix of a larger array" Combine these two e...

alrededor de 1 mes ago | 0

Answered

How do you import specific rows of numeric data (without text) for the file I have attached?

Maybe not the most rubust way, but it does the job. (The numerical blocks must be followed by non-numerical text.) %% ffs = '1...

How do you import specific rows of numeric data (without text) for the file I have attached?

Maybe not the most rubust way, but it does the job. (The numerical blocks must be followed by non-numerical text.) %% ffs = '1...

alrededor de 1 mes ago | 0

| accepted

Answered

How to Speedup conditional vector elements replacement?

There is a Matlab function, repelem, that does it. >> repelem( b, a ) ans = Columns 1 through 13 1 6 6 6 ...

How to Speedup conditional vector elements replacement?

There is a Matlab function, repelem, that does it. >> repelem( b, a ) ans = Columns 1 through 13 1 6 6 6 ...

alrededor de 1 mes ago | 0

| accepted

Answered

Create all combination of strings

See: perms, All possible permutations In response to comment Does the function, cssm(), do what you ask for? >> all_permuta...

Create all combination of strings

See: perms, All possible permutations In response to comment Does the function, cssm(), do what you ask for? >> all_permuta...

alrededor de 1 mes ago | 0

Question

How to edit and replace comments on File Exchange submissions?

It's a hidden algorithm that controls what happens when I write comments on my submissions at File Exchange. I failed to find a ...

alrededor de 2 meses ago | 0 answers | 0

Answered

Speed up code:: Code is working but slow..

See: Profile Your Code to Improve Performance and Techniques to Improve Performance

Speed up code:: Code is working but slow..

See: Profile Your Code to Improve Performance and Techniques to Improve Performance

alrededor de 2 meses ago | 0

Answered

How do I use numerical and logical indices to get this output?

One out of many ways %% myArray = [2, 4, -3, 6, 9]; isneg = myArray < 0; myArray( isneg ) = 1;

How do I use numerical and logical indices to get this output?

One out of many ways %% myArray = [2, 4, -3, 6, 9]; isneg = myArray < 0; myArray( isneg ) = 1;

alrededor de 2 meses ago | 1

Answered

Change [ ] cells in .mat file to NaN

I don't fully understand your question. See: TUTORIAL: how to ask a question (on Answers) and get a fast answer "The code bel...

Change [ ] cells in .mat file to NaN

I don't fully understand your question. See: TUTORIAL: how to ask a question (on Answers) and get a fast answer "The code bel...

alrededor de 2 meses ago | 0

Answered

How do I append a row average to a new matrix

With a little bit of guessing. Does this answer your question? %% foo = randi(500,500); cac = mat2cell( foo, 5*ones(100,1), 5...

How do I append a row average to a new matrix

With a little bit of guessing. Does this answer your question? %% foo = randi(500,500); cac = mat2cell( foo, 5*ones(100,1), 5...

alrededor de 2 meses ago | 1

| accepted

Answered

Preventing too many function inputs

>> exfunction(1,3,9,4,5) throws the error Error using exfunction Too many input arguments. I assume that's the error you e...

Preventing too many function inputs

>> exfunction(1,3,9,4,5) throws the error Error using exfunction Too many input arguments. I assume that's the error you e...

alrededor de 2 meses ago | 0