Question

Efficient number occurence count

I want to efficiently count the number of occurences of numbers between 1-numel(num) in a Matrix. I came up with two options for...

11 days ago | 3 answers | 1

Answered

How to put cell array in sprintf?

If using multiple different cells: %% Edited % var = {'a','b','c','d','e'}; % num = {1,2,3,4,5}; % s = strjoin(cellfun(@(v...

How to put cell array in sprintf?

If using multiple different cells: %% Edited % var = {'a','b','c','d','e'}; % num = {1,2,3,4,5}; % s = strjoin(cellfun(@(v...

2 months ago | 0

Answered

How to indicate that GUI is busy running?

Users that looked for a waitbar style solution should have a look at https://de.mathworks.com/help/matlab/ref/uiprogressdlg.html...

How to indicate that GUI is busy running?

Users that looked for a waitbar style solution should have a look at https://de.mathworks.com/help/matlab/ref/uiprogressdlg.html...

4 months ago | 0

Answered

How to support default parameter in MATLAB FUNCTION ?

The Answers are not up to date. Modern MATLAB supports the arguments Block: function out = foo(in) arguments in(1...

How to support default parameter in MATLAB FUNCTION ?

The Answers are not up to date. Modern MATLAB supports the arguments Block: function out = foo(in) arguments in(1...

4 months ago | 2

Answered

Multiple numerics as one map key / Merge Objects based on parameters

The only keytype which can hold two doubles is the character key type. So one may use char as key type and then simply function...

Multiple numerics as one map key / Merge Objects based on parameters

The only keytype which can hold two doubles is the character key type. So one may use char as key type and then simply function...

4 months ago | 0

| accepted

Question

Multiple numerics as one map key / Merge Objects based on parameters

I want to use two numerics as a single key for a map to merge similar objects of a class. How can I do that? My class looks lik...

4 months ago | 1 answer | 0

Answered

How do I convert a numerical vector into a comma-delimited string?

Here is another oneliner: strjoin(cellstr(num2str(n')),',') Testing all four types with a script n = randi(100,[1 100]); tic...

How do I convert a numerical vector into a comma-delimited string?

Here is another oneliner: strjoin(cellstr(num2str(n')),',') Testing all four types with a script n = randi(100,[1 100]); tic...

4 months ago | 1

Answered

How do I limit the values in an array?

There is also a matlab function doing this: A = min(A,1); It takes A if A is the minimum of the two and 1 if 1 is the minimum ...

How do I limit the values in an array?

There is also a matlab function doing this: A = min(A,1); It takes A if A is the minimum of the two and 1 if 1 is the minimum ...

5 months ago | 0

Answered

How to create a checkerboard matrix without inbuilt function.

For an even sized checkerboard: rows = 6; cols = 4; normal = repmat(eye(2,'logical'),[rows/2 cols/2]); % or inverted = repm...

How to create a checkerboard matrix without inbuilt function.

For an even sized checkerboard: rows = 6; cols = 4; normal = repmat(eye(2,'logical'),[rows/2 cols/2]); % or inverted = repm...

5 months ago | 0

Answered

How to write an efficient overloaded subsasgn?

I may have a solution but do not know if this covers all cases: classdef Subsasgntest properties val e...

How to write an efficient overloaded subsasgn?

I may have a solution but do not know if this covers all cases: classdef Subsasgntest properties val e...

5 months ago | 0

| accepted

Question

How to write an efficient overloaded subsasgn?

I want to write a class which defines subsasgn. The class holds a numeric value val and the subsasgn should target val only. I ...

5 months ago | 1 answer | 0

Answered

combine columns with different lengths to create a matrix

If the input data is a cell array of column vectors, you might consider this: a = {ones(5,1) ones(8,1)}; %test data len = ma...

combine columns with different lengths to create a matrix

If the input data is a cell array of column vectors, you might consider this: a = {ones(5,1) ones(8,1)}; %test data len = ma...

5 months ago | 0

Answered

horzcat different size rows; zero padding

If the input data is a cell array of column vectors, you might consider this: a = {ones(5,1) ones(8,1)}; %test data len = max(...

horzcat different size rows; zero padding

If the input data is a cell array of column vectors, you might consider this: a = {ones(5,1) ones(8,1)}; %test data len = max(...

5 months ago | 0

Answered

Regex: How do I match an empty string?

Use regexp(a,'^$','emptymatch')

Regex: How do I match an empty string?

Use regexp(a,'^$','emptymatch')

6 months ago | 0

| accepted

Question

Regex: How do I match an empty string?

Consider the following string: a = ''; How can I match it using regexp?

6 months ago | 1 answer | 0

Question

Override subsasgn of MATLABs double?

Consider the following statement: x = [1 2;3 4]; y = myclass([5 6]); x(1:2) = y MATLABs default behavior is: x(1:2) = ... r...

6 months ago | 2 answers | 0

Question

Does MATLAB call the double constructor on a=a+1?

I want to overload the double class and add some properties to it. And i also have to override the plus function. A similar cod...

6 months ago | 1 answer | 0

Answered

[Fixed Point Converter] 1000 bit fraction length at 2^x if x is loaded from .mat file?

A temporary fix is using bitsll as recommended here: For efficient HDL code generation, use the Fixed-Point Designer ...

[Fixed Point Converter] 1000 bit fraction length at 2^x if x is loaded from .mat file?

A temporary fix is using bitsll as recommended here: For efficient HDL code generation, use the Fixed-Point Designer ...

7 months ago | 0

| accepted

Question

[Fixed Point Converter] 1000 bit fraction length at 2^x if x is loaded from .mat file?

I got a problem with code like this in the fixed-point converter: dut_tb.m dut(8); dut.m function out = dut(in) S = cod...

7 months ago | 2 answers | 0

Answered

[HDL Coder] Ridiculous RAM usage + How to activate parallel processing?

This memory usage is not sane and it is the result of not properly optimized MATLAB code for HDL conversion. I tried to run code...

[HDL Coder] Ridiculous RAM usage + How to activate parallel processing?

This memory usage is not sane and it is the result of not properly optimized MATLAB code for HDL conversion. I tried to run code...

7 months ago | 0

| accepted

Answered

Odd and even numbers

Fancy answer: m = [1 2 3;4 5 6]; isodd = bitget(m,1) however this is slower as rem

Odd and even numbers

Fancy answer: m = [1 2 3;4 5 6]; isodd = bitget(m,1) however this is slower as rem

7 months ago | 0

Question

[HDL Coder] Bug: Fixed point converter does not descend into System Objects

Can I somehow tell the fixed point converter to explicitly convert a certain function? This would temporarily fix the following ...

7 months ago | 1 answer | 0

Question

[HDL Coder] Ridiculous RAM usage + How to activate parallel processing?

On my project, the HDL Coder uses ridiculus amounts of RAM. On my 8GB Windows 10 Notebook, it chews through it until after 3min ...

7 months ago | 1 answer | 0

Answered

[Coder] Which types are supported for constant folding?

I did understand constant folding wrong: I thought one must help the coder as follows: a = coder.const(my_prod(3,2)); , becau...

[Coder] Which types are supported for constant folding?

I did understand constant folding wrong: I thought one must help the coder as follows: a = coder.const(my_prod(3,2)); , becau...

7 months ago | 0

| accepted

Answered

Fixed point converter: Ignore code part.

Ignoring a code part in fixed point converter is currenty(R2019b) not supported. Comment out the section as a temporary fix.

Fixed point converter: Ignore code part.

Ignoring a code part in fixed point converter is currenty(R2019b) not supported. Comment out the section as a temporary fix.

7 months ago | 0

| accepted

Answered

[HDL Coder]: BUG?/ Function Location missing in Error Report -> find variable by name?

As long a the location of error lines is not shown correctly in MATLAB HDL Coder, assign the top function call as a var = cod...

[HDL Coder]: BUG?/ Function Location missing in Error Report -> find variable by name?

As long a the location of error lines is not shown correctly in MATLAB HDL Coder, assign the top function call as a var = cod...

7 months ago | 0

| accepted

Question

[HDL Coder]: BUG?/ Function Location missing in Error Report -> find variable by name?

In HDL Coder, I want to locate, where errors are occuring. But the HTML Report just gives me the Error Location in the top comp...

7 months ago | 3 answers | 0

Answered

running matlab using command line

For R2019 users: -nodisplay & -nodesktop do not exist. Use: matlab -batch "Main; exit"

running matlab using command line

For R2019 users: -nodisplay & -nodesktop do not exist. Use: matlab -batch "Main; exit"

7 months ago | 3

Question

[Fixed-point converter] Passing constant struct to entry point

I have passed a constant struct to the input of MATLAB HDL Coder.Lets say param.a = 'red' In the code, it is responsible for ch...

7 months ago | 2 answers | 0

Question

[Coder] Which types are supported for constant folding?

In MATLAB HDL coder I try to do constant folding on the output of a function. The output type is a 1x262144 uint16. The coder ...

7 months ago | 1 answer | 0