Answered
Function handle in structure field generating data from other fields
With a structure, it's not possible to do what you want. With a class, yes, using dependent properties. classdef DemoClass ...

7 years ago | 0

| accepted

Answered
Problem with piece-wise function with logical indexing.
But I don't understand WHY matlab is evaluating this bit of the fuction when it's outside the specified range (t>=1200). That e...

7 years ago | 1

| accepted

Answered
How to recognize if there is in a character a point '.'?
Edit: I misunderstood the question. It's even simpler than what I initially wrote. Simply: xx == '.' If you want to check mul...

7 years ago | 1

Answered
Swap group of elements in a matrix with specific conditions
Indeed use, findgroup and splitapply: group = findgroups(a(:, 1), a(:, 2)); groupswap = splitapply(@(c3, c4) max(c4)>max(c3), ...

7 years ago | 0

| accepted

Answered
How do I get specific data using inpolygon in Matlab?
I don't have the mapping toolbox and knows nothing about it, so possibly the problem is with your coordinate transformation code...

7 years ago | 1

| accepted

Answered
i am trying to find the euclidean distance of 2 vector with different sizes
I'm also not clear on what you're asking. If you want to find the euclidean distance between each row of T and each row of X, th...

7 years ago | 0

| accepted

Answered
why I get unintelligible text
what wrong in my code You're using fscanf to read both numbers and text. it doesn't work very well for that. In particular, the...

7 years ago | 0

| accepted

Answered
How can I generate C++ class from a class implemented in Matlab?
The only way is by writing the C++ code yourself. There's enough difference between matlab classes and C++ classes that it may n...

7 years ago | 0

Answered
How to write repeating string with variables in for loop
Well, if you really want uncluttered: line = cell(7, 75); line([1 3 5 6 7], :) = repmat({' new ScreenItem(ScreenVideoComp...

7 years ago | 1

Answered
Extracting edited tables from cell array and saving them back to original variables
Note if logicalvalue == 1 is the same as asking if true is true. It's a bit redundant. In addition in matlab it involves conv...

7 years ago | 0

| accepted

Answered
Select rows in a table given two conditions
I'm not conviced that your TAB1 is actually a table. If it is: TAB1.Value(strcmp(TAB1.Description, 'CO2') & TAB1.Year == 2020)...

7 years ago | 0

| accepted

Answered
How to search for channel name and numerical data in resulting struct after importing multiple data files?
Considering that one of the variable is time, you may be better off storing your data in a timetable rather than a structure Th...

7 years ago | 0

Answered
besoin d'ajouter figure/Image pour la génération d'un rapport
Je n'ai pas la toolbox, mais si j'ai bien compris la documentation: append(D, Figure('fleche maximale.fig')); translation: I d...

7 years ago | 1

Answered
Reading text file using fprintf and textscan
You could continue to use textscan, you don't specify line endings and separators in the format string: fid = fopen('test.txt')...

7 years ago | 0

| accepted

Answered
Select elements from only three consecutive columns.
startcolumn = randi(size(yourmatrix, 2) - 2); %select 1st of 3 consecutive column at random candidateelements = yourmatrix(:, ...

7 years ago | 0

| accepted

Answered
how to export data into text file
Assuming that your Values_S_Cx vectors were column vectors so that Single is a numel(Total) x Ncolumns matrix, then: writetable...

7 years ago | 1

| accepted

Answered
Delete Columns from a table where the 1st element in the column is a negative number?
Your screenshot does not appear to be that of a matlab table. It looks like you have a matrix, so: yourmatrix(:, yourmatrix(1, ...

7 years ago | 0

| accepted

Answered
Does using cells cause dramatically slow down the code?
A cell array of scalar numbers will always be slower to process that a matrix with the same scalar numbers, yes. There's also no...

7 years ago | 1

| accepted

Answered
Adding a frame of zeros to a matrix
Not sure which corner you want to pad with zeros. I'm assuming bottom right: newmatrix = [yourmatrix, zeros(size(yourmatrix, 1)...

7 years ago | 1

| accepted

Answered
How to compare two matrices in different sizes/dimensions ?
C = intersect(A, B, 'rows') %possibly with the 'stable' option if ordering matters.

7 years ago | 0

| accepted

Answered
Text file parse and reformat and storage
Your file is an xml file, so it should be parsed with an xml parser. Parsing it as text or html will always be fragile. Thankful...

7 years ago | 1

Answered
Apply the same function into several columns
Use a loop: B = zeros(1, size(A, 2)); for column = 1 : size(A, 2) B(column) = yourfunction(A(:, column)); end Or you ca...

7 years ago | 0

| accepted

Answered
if-loop: Devide a table and save the parts in cell array
Note that you are not using what matlab calls a table. You may actually be better off using tables or even better timetables. A...

7 years ago | 0

Answered
problem displaying data on spreadsheet
When you create a table, if you want the elements of the inputs to become rows of the table, then you need these inputs to be co...

7 years ago | 0

| accepted

Answered
How to colour columns of a matrix
The first problem with your code is that you're assuming c is integer when it will most likely not be. In any case, the whole l...

7 years ago | 1

| accepted

Answered
How to Create Multidimensional table in for loop
You could store your 15 tables into a cell array, Trajectory = 1:15; TrajDetail = cell(size(Trajectory)); for i = 1:numel(Tra...

7 years ago | 0

Answered
How to do wait calllib to give answer or catch exception?
No, you can't do something like that in matlab and even in languages were you have access to the OS API it wouldn't be trivial t...

7 years ago | 0

| accepted

Answered
Why am I getting 'ans=45' in this code?
If a function normally return an output but you don't assign this output to a variable, matlab automatically create a variable c...

7 years ago | 1

Answered
matlab cell array indexing
I'm assuming your C1 and C2 are not actual numbered variables but elements of a cell array, in which case: newC = cellfun(@(c) ...

7 years ago | 0

| accepted

Answered
Script that Accurately counts lines in a text file
linecount = sum(fileread(somefile) == 10) + 1; See Walter's comment. This will count the emptiness between the newline and end ...

7 years ago | 0

Load more