Answered

can anyone help me prepare the code

Problems with your script The long lines make the code hard to read. Numerous statement separators are missing I added line ...

can anyone help me prepare the code

Problems with your script The long lines make the code hard to read. Numerous statement separators are missing I added line ...

9 maanden ago | 0

Answered

is it possible to create array of strings or char from struct of cell arrays

There are character arrays (See Text and Characters) A(1).name='one'; A(1).val=1; A(2).name='two'; A(2).val=2; {A.name} [A.na...

is it possible to create array of strings or char from struct of cell arrays

There are character arrays (See Text and Characters) A(1).name='one'; A(1).val=1; A(2).name='two'; A(2).val=2; {A.name} [A.na...

9 maanden ago | 0

| accepted

Answered

Changing elements in a MxN matrix

Does this help? %% matrix = magic(10); matrix = triu( matrix,-4 ); matrix = tril( matrix, 4 ) %% This is better, it only ...

Changing elements in a MxN matrix

Does this help? %% matrix = magic(10); matrix = triu( matrix,-4 ); matrix = tril( matrix, 4 ) %% This is better, it only ...

9 maanden ago | 0

| accepted

Answered

Extracting values out of a cell array with tables

This script puts all the numerical data into a row vector (column-wise). You didn't say anything about order. %% load('CA.mat'...

Extracting values out of a cell array with tables

This script puts all the numerical data into a row vector (column-wise). You didn't say anything about order. %% load('CA.mat'...

9 maanden ago | 1

| accepted

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)...

9 maanden 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...

9 maanden 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'); >> ...

9 maanden 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 maanden 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...

10 maanden 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 ...

10 maanden 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...

10 maanden 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+...

10 maanden 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...

10 maanden 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 = {[ ...

10 maanden 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...

10 maanden 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...

10 maanden 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...

10 maanden 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...

10 maanden 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...

10 maanden 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

10 maanden 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

10 maanden 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

10 maanden 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 >>...

10 maanden 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) ...

10 maanden 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...

11 maanden 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...

11 maanden 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 ...

11 maanden 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...

11 maanden 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 ...

11 maanden 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

11 maanden ago | 0